Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to authenticate when using cache provider #443

Open
christian-hawk opened this issue Jun 4, 2022 · 0 comments
Open

Not able to authenticate when using cache provider #443

christian-hawk opened this issue Jun 4, 2022 · 0 comments
Assignees
Labels
Projects
Milestone

Comments

@christian-hawk
Copy link
Contributor

When trying to authenticate using a cache provider, we get a TypeError: this.cacheProvider.saveAsync is not a function error message.

2022-06-04 16:10:58.933+0000 [INFO]     Response received
2022-06-04 16:10:58.933+0000 [INFO]     Configuration data has been parsed
2022-06-04 16:10:58.933+0000 [DEBUG]    entered recreateHttpServer(serverURI=https://apitest.techno24x7.com,port=8090
2022-06-04 16:10:58.933+0000 [DEBUG]    httpPort = 8090
2022-06-04 16:11:01.400+0000 [VERBOSE]  Issuing token
2022-06-04 16:11:01.401+0000 [INFO]     159.223.101.115 - GET /passport/token HTTP/1.1 200 201 - 1.530 ms
2022-06-04 16:11:01.528+0000 [VERBOSE]  Validating token
2022-06-04 16:11:01.528+0000 [VERBOSE]  Authenticating request against samltest.id
2022-06-04 16:11:01.530+0000 [ERROR]    Error: TypeError: this.cacheProvider.saveAsync is not a function
2022-06-04 16:11:01.530+0000 [ERROR]    TypeError: this.cacheProvider.saveAsync is not a function
    at SAML.generateAuthorizeRequestAsync (/opt/gluu/node/passport/node_modules/passport-saml/lib/node-saml/saml.js:183:38)
    at SAML.getAuthorizeUrlAsync (/opt/gluu/node/passport/node_modules/passport-saml/lib/node-saml/saml.js:407:36)
    at login-request (/opt/gluu/node/passport/node_modules/passport-saml/lib/passport-saml/strategy.js:106:60)
    at Strategy.authenticate (/opt/gluu/node/passport/node_modules/passport-saml/lib/passport-saml/strategy.js:129:13)
    at attempt (/opt/gluu/node/passport/node_modules/passport/lib/middleware/authenticate.js:366:16)
    at authenticate (/opt/gluu/node/passport/node_modules/passport/lib/middleware/authenticate.js:367:7)
    at authenticateRequest (/opt/gluu/node/passport/server/routes.js:112:77)
    at Layer.handle [as handle_request] (/opt/gluu/node/passport/node_modules/express/lib/router/layer.js:95:5)
    at next (/opt/gluu/node/passport/node_modules/express/lib/router/route.js:137:13)
    at validateToken (/opt/gluu/node/passport/server/routes.js:140:5)
    at Layer.handle [as handle_request] (/opt/gluu/node/passport/node_modules/express/lib/router/layer.js:95:5)
    at next (/opt/gluu/node/passport/node_modules/express/lib/router/route.js:137:13)
    at validateProvider (/opt/gluu/node/passport/server/routes.js:103:5)
    at Layer.handle [as handle_request] (/opt/gluu/node/passport/node_modules/express/lib/router/layer.js:95:5)
    at next (/opt/gluu/node/passport/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/opt/gluu/node/passport/node_modules/express/lib/router/route.js:112:3)

This happens because we did not upgraded a badly documented breaking change from passport-saml module:

return {
save: function (key, value, cb) {
if (ready) {
setAsync(key, value, 'EX', exp)
.then(_ => cb(null, value))
.catch(err => cb(err, null))
} else {
logger.log2('warn', OPERATION_NO_CONN)
}
},
get: function (key, cb) {
if (ready) {
getAsync(key)
.then(value => cb(null, value))
.catch(err => cb(err, null))
} else {
logger.log2('warn', OPERATION_NO_CONN)
}
},
remove: function (key, cb) {
if (ready) {
delAsync(key)
.then(res => cb(null, res === 0 ? null : key))
.catch(err => cb(err, null))
} else {
logger.log2('warn', OPERATION_NO_CONN)
}
}
}
}

It also looks like this scenario has not been tested.

@christian-hawk christian-hawk added this to the 5.0 milestone Jun 4, 2022
@christian-hawk christian-hawk added this to To do in Passport via automation Jun 4, 2022
@christian-hawk christian-hawk self-assigned this Jun 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Passport
  
To do
Development

No branches or pull requests

1 participant