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)
| 181 | // <img src="/logout"> CSRF vector because an attacker on a third-party |
| 182 | // page cannot synthesise a valid signature. |
| 183 | func (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 | } |
no test coverage detected