MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / isValidIDTokenHint

Method isValidIDTokenHint

internal/http_handlers/logout.go:183–197  ·  view source on GitHub ↗

isValidIDTokenHint verifies a logout id_token_hint by parsing the JWT against the server's own signing key. The token does not need to be unexpired (the OIDC spec explicitly allows expired ID tokens as logout hints) — only that the signature is valid and the token claims to have been issued by this

(idTokenHint string)

Source from the content-addressed store, hash-verified

181// <img src="/logout"> CSRF vector because an attacker on a third-party
182// page cannot synthesise a valid signature.
183func (h *httpProvider) isValidIDTokenHint(idTokenHint string) bool {
184 if idTokenHint == "" {
185 return false
186 }
187 claims, err := h.TokenProvider.ParseJWTToken(idTokenHint)
188 if err != nil || claims == nil {
189 return false
190 }
191 // Sanity-check that this looks like an ID token (not, say, a refresh
192 // token someone tried to slip through).
193 if tt, ok := claims["token_type"].(string); ok && tt != "" && tt != "id_token" {
194 return false
195 }
196 return true
197}

Callers 1

LogoutHandlerMethod · 0.95

Calls 1

ParseJWTTokenMethod · 0.65

Tested by

no test coverage detected