Skip to content

Dynamically Set Audience #121

@ebenezerw

Description

@ebenezerw

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) } })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions