mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-08 00:50:28 +08:00
feat: add validation for optional fields in IntrospectionToken for custom token types (#3717)
This commit is contained in:
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user