mirror of
https://github.com/andwati/zitadel.git
synced 2026-12-01 16:38:52 +00:00
fix: id token had no lifetime for client credentials (#11204)
# Which Problems Are Solved - ID-token had no lifetime when a token was requested using the `client_credentials` grant # How the Problems Are Solved - Take use the lifetime provided by the server. # Additional Context - Closes #11060
This commit is contained in:
@@ -34,18 +34,20 @@ func (s *Server) clientCredentialsAuth(ctx context.Context, clientID, clientSecr
|
|||||||
|
|
||||||
s.command.MachineSecretCheckSucceeded(ctx, user.ID, user.ResourceOwner, updated)
|
s.command.MachineSecretCheckSucceeded(ctx, user.ID, user.ResourceOwner, updated)
|
||||||
return &clientCredentialsClient{
|
return &clientCredentialsClient{
|
||||||
clientID: user.Username,
|
clientID: user.Username,
|
||||||
userID: user.ID,
|
userID: user.ID,
|
||||||
resourceOwner: user.ResourceOwner,
|
resourceOwner: user.ResourceOwner,
|
||||||
tokenType: user.Machine.AccessTokenType,
|
tokenType: user.Machine.AccessTokenType,
|
||||||
|
idTokenLifeTime: s.defaultIdTokenLifetime,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type clientCredentialsClient struct {
|
type clientCredentialsClient struct {
|
||||||
clientID string
|
clientID string
|
||||||
userID string
|
userID string
|
||||||
resourceOwner string
|
resourceOwner string
|
||||||
tokenType domain.OIDCTokenType
|
tokenType domain.OIDCTokenType
|
||||||
|
idTokenLifeTime time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
// AccessTokenType returns the AccessTokenType for the token to be created because of the client credentials request
|
// AccessTokenType returns the AccessTokenType for the token to be created because of the client credentials request
|
||||||
@@ -97,9 +99,8 @@ func (c *clientCredentialsClient) LoginURL(_ string) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
// IDTokenLifetime returns 0 as there is no id_token issued
|
|
||||||
func (c *clientCredentialsClient) IDTokenLifetime() time.Duration {
|
func (c *clientCredentialsClient) IDTokenLifetime() time.Duration {
|
||||||
return 0
|
return c.idTokenLifeTime
|
||||||
}
|
}
|
||||||
|
|
||||||
// DevMode returns false as there is no dev mode
|
// DevMode returns false as there is no dev mode
|
||||||
|
|||||||
Reference in New Issue
Block a user