You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jwt.js 713B

1234567891011121314151617181920212223242526272829
  1. 'use strict'
  2. module.exports = options => {
  3. return {
  4. keys: {
  5. key: options.jwtKey,
  6. algorithms: ['HS256'],
  7. },
  8. verify: {
  9. aud: 'urn:audience:test',
  10. iss: 'urn:issuer:test',
  11. sub: false,
  12. maxAgeSec: 14400, // 4 hours
  13. },
  14. validate: (artifacts, request, h) => {
  15. try {
  16. return {
  17. isValid: true,
  18. credentials: { user: artifacts.decoded.payload.user },
  19. }
  20. } catch (err) {
  21. console.error(err)
  22. return {
  23. isValid: false,
  24. }
  25. }
  26. },
  27. }
  28. }