feat: add validation for optional fields in IntrospectionToken for custom token types (#3717)

This commit is contained in:
Gabriel Brecci
2025-04-09 11:27:19 -03:00
committed by GitHub
parent a00900e405
commit fc618b9bd5

View File

@ -384,10 +384,7 @@ func (c *ApiController) IntrospectToken() {
introspectionResponse = object.IntrospectionResponse{
Active: true,
Scope: jwtToken.Scope,
ClientId: clientId,
Username: jwtToken.Name,
TokenType: jwtToken.TokenType,
Exp: jwtToken.ExpiresAt.Unix(),
Iat: jwtToken.IssuedAt.Unix(),
Nbf: jwtToken.NotBefore.Unix(),
@ -396,6 +393,16 @@ func (c *ApiController) IntrospectToken() {
Iss: jwtToken.Issuer,
Jti: jwtToken.ID,
}
if jwtToken.Scope != "" {
introspectionResponse.Scope = jwtToken.Scope
}
if jwtToken.Name != "" {
introspectionResponse.Username = jwtToken.Name
}
if jwtToken.TokenType != "" {
introspectionResponse.TokenType = jwtToken.TokenType
}
}
if tokenTypeHint == "" {