feat: improve token introspection endpoint (#534)

* feat: add introspection endpoint to oidc discovery endpoint

* fix: let introspect endpoint handle formData as spec define.

Signed-off-by: Leon <leondevlifelog@gmail.com>
This commit is contained in:
Leon
2022-03-04 08:54:33 +08:00
committed by GitHub
parent ab5af979c8
commit 178cf7945d
3 changed files with 7 additions and 13 deletions

View File

@ -30,6 +30,7 @@ type OidcDiscovery struct {
TokenEndpoint string `json:"token_endpoint"`
UserinfoEndpoint string `json:"userinfo_endpoint"`
JwksUri string `json:"jwks_uri"`
IntrospectionEndpoint string `json:"introspection_endpoint"`
ResponseTypesSupported []string `json:"response_types_supported"`
ResponseModesSupported []string `json:"response_modes_supported"`
GrantTypesSupported []string `json:"grant_types_supported"`
@ -74,6 +75,7 @@ func GetOidcDiscovery(host string) OidcDiscovery {
TokenEndpoint: fmt.Sprintf("%s/api/login/oauth/access_token", originBackend),
UserinfoEndpoint: fmt.Sprintf("%s/api/userinfo", originBackend),
JwksUri: fmt.Sprintf("%s/.well-known/jwks", originBackend),
IntrospectionEndpoint: fmt.Sprintf("%s/api/login/oauth/introspect", originBackend),
ResponseTypesSupported: []string{"id_token"},
ResponseModesSupported: []string{"login", "code", "link"},
GrantTypesSupported: []string{"password", "authorization_code"},

View File

@ -60,14 +60,6 @@ type TokenWrapper struct {
Scope string `json:"scope"`
}
type TokenIntrospectionRequest struct {
// access_token's value or refresh_token's value
Token string `json:"token"`
// pass this parameter to help the authorization server optimize the token lookup.
// value is one of `access_token` or `refresh_token`
TokenTypeHint string `json:"token_type_hint,omitempty"`
}
type IntrospectionResponse struct {
Active bool `json:"active"`
Scope string `json:"scope,omitempty"`