panva / openid-client

OAuth 2 / OpenID Connect Client API for JavaScript Runtimes
MIT License
1.83k stars 392 forks source link

feat: add callback extras to strategy options #295

Closed jonalu closed 4 years ago

jonalu commented 4 years ago

The problem

Currently the Strategy does not support client assertions making it troublesome to use with Passport.

Proposed solution

Pass option extras: CallbackExtras to the StrategyOptions interface like so:

const strategy = new Strategy({
        client,
        params: {
            scope: 'openid profile',
        },
        extras: {
            clientAssertionPayload: {
                aud: metadata.issuer
            }
        }
    }, (tokenSet: TokenSet, done: (_err: any, _user?: any) => void) => {
        done(null, tokenSet)
    });

The function OpenIDConnectStrategy.prototype.authenticate is changed to include the client._extras as the last parameter to client.callback

jonalu commented 4 years ago

There's a lot that seems to have been done by whatever IDEs automated formatting. Please remove those change and only keep what's new.

@panva Thanks! Do you mind having another look at it?