git.iko.soy/typeable/oauth2-proxy
on master help sign in
Validate OIDC Session State
commitcac2c9728de927f81e6df5e9babccdfed581d0a6 authorJoel Speed <Joel.speed@hotmail.co.uk> dateThu 21 Jun 2018, 11:31 (8 years ago) parent1b638f3
1 file changed+11
providers/oidc.go+11
providers/oidc.go+11
@@ -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+}