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

@ -383,18 +383,25 @@ func (c *ApiController) IntrospectToken() {
} }
introspectionResponse = object.IntrospectionResponse{ introspectionResponse = object.IntrospectionResponse{
Active: true, Active: true,
Scope: jwtToken.Scope, ClientId: clientId,
ClientId: clientId, Exp: jwtToken.ExpiresAt.Unix(),
Username: jwtToken.Name, Iat: jwtToken.IssuedAt.Unix(),
TokenType: jwtToken.TokenType, Nbf: jwtToken.NotBefore.Unix(),
Exp: jwtToken.ExpiresAt.Unix(), Sub: jwtToken.Subject,
Iat: jwtToken.IssuedAt.Unix(), Aud: jwtToken.Audience,
Nbf: jwtToken.NotBefore.Unix(), Iss: jwtToken.Issuer,
Sub: jwtToken.Subject, Jti: jwtToken.ID,
Aud: jwtToken.Audience, }
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
} }
} }