callback_handler.go: assert nonce is stored correctly

I think we want to do this here since we are storing all of the
other ID token claims?

Signed-off-by: Andrew Keesler <akeesler@vmware.com>
This commit is contained in:
Andrew Keesler
2020-11-20 08:38:23 -05:00
parent b25696a1fb
commit f8d76066c5
2 changed files with 17 additions and 6 deletions

View File

@@ -97,7 +97,13 @@ func NewHandler(
return err
}
openIDSession := makeDownstreamSession(downstreamIssuer, downstreamAuthParams.Get("client_id"), username, groups)
openIDSession := makeDownstreamSession(
downstreamIssuer,
downstreamAuthParams.Get("client_id"),
downstreamAuthParams.Get("nonce"),
username,
groups,
)
authorizeResponder, err := oauthHelper.NewAuthorizeResponse(r.Context(), authorizeRequester, openIDSession)
if err != nil {
plog.WarningErr("error while generating and saving authcode", err, "upstreamName", upstreamIDPConfig.GetName())
@@ -291,7 +297,7 @@ func getGroupsFromUpstreamIDToken(
return groups, nil
}
func makeDownstreamSession(issuer, clientID, username string, groups []string) *openid.DefaultSession {
func makeDownstreamSession(issuer, clientID, nonce, username string, groups []string) *openid.DefaultSession {
now := time.Now()
openIDSession := &openid.DefaultSession{
Claims: &jwt.IDTokenClaims{
@@ -302,6 +308,7 @@ func makeDownstreamSession(issuer, clientID, username string, groups []string) *
IssuedAt: now,
RequestedAt: now,
AuthTime: now,
Nonce: nonce,
},
}
if groups != nil {