Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 9249b07

Browse files
committed
Validate OIDC Session State
1 parent b7ad46b commit 9249b07

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

providers/oidc.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,14 @@ func (p *OIDCProvider) createSessionState(ctx context.Context, token *oauth2.Tok
128128
Email: claims.Email,
129129
}, nil
130130
}
131+
132+
// ValidateSessionState checks that the session's IDToken is still valid
133+
func (p *OIDCProvider) ValidateSessionState(s *SessionState) bool {
134+
ctx := context.Background()
135+
_, err := p.Verifier.Verify(ctx, s.IDToken)
136+
if err != nil {
137+
return false
138+
}
139+
140+
return true
141+
}

0 commit comments

Comments
 (0)