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

Dynamically Set Audience #121

Open
ebenezerw opened this issue Mar 22, 2021 · 0 comments
Open

Dynamically Set Audience #121

ebenezerw opened this issue Mar 22, 2021 · 0 comments

Comments

@ebenezerw
Copy link

Is it possible to dynamically set the audience option after the request is received? Here is my use case:
I'm building an SSO solution between two systems. Both systems are multi-tenants and users need to be able to SSO into their respective tenant account. For example, users in System X: Tenant 1 should log into System Y: Tenant 1; System X: Tenant 2 logs into System Y: Tenant 2.

SSO is initiated from System X and I'm able to perform the validation in the getPostURL step. I'm also able to determine the appropriate audience URL during this step which is the same as userData.ssoURL in the callback. Is it possible to set the audience value at this point? When I hardcode the audience URL it works so this is just the last step for me to get this fully functional. Thanks

exports.saml = samlp.auth({ audience: 'https://....', issuer: 'the-issuer', cert: fs.readFileSync('...'), key: fs.readFileSync(...'), getPostURL: async function (audience, wreply, req, callback) { const userData = await validateUser(req) req.user = { emails: [{ value: userData.emails }], displayName: userData.id, id: userData.id, name: { givenName: userData.name, familyName: userData.name } } return callback(null, userData.ssoURL) } })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant