From 52fa4325efe457e86467200963326ab7fa01aae8 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 10 Nov 2020 10:08:49 +0100 Subject: [PATCH] refactor: rename `token_type` to `token_use` in introspection Closes #1762 BREAKING CHANGE: This changes the OAuth2 Token Introspection response to ensure compliance with the OAuth2 Token Introspection specification. Previously, `token_type` would return `access_token` or `refresh_token`. The specification however mandates that `token_type` is always `Bearer`. This patch resolves that issue. The previous behaviour of `token_type` has now been moved to `token_use` which can be `access_token` or `refresh_token`. --- oauth2/introspector.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/oauth2/introspector.go b/oauth2/introspector.go index 9efc16520d0..2f7995914c3 100644 --- a/oauth2/introspector.go +++ b/oauth2/introspector.go @@ -78,9 +78,12 @@ type Introspection struct { // IssuerURL is a string representing the issuer of this token Issuer string `json:"iss,omitempty"` - // TokenType is the introspected token's type, for example `access_token` or `refresh_token`. + // TokenType is the introspected token's type, typically `Bearer`. TokenType string `json:"token_type,omitempty"` + // TokenUse is the introspected token's use, for example `access_token` or `refresh_token`. + TokenUse string `json:"token_use,omitempty"` + // Extra is arbitrary data set by the session. Extra map[string]interface{} `json:"ext,omitempty"` }