mirror of
https://github.com/andwati/zitadel.git
synced 2026-10-31 19:42:15 +00:00
Merge commit from fork
* fix: client_id verification during code exchange and refresh token flows * add clientID check for device token flow * Trigger Build
This commit is contained in:
@@ -62,6 +62,10 @@ func (s *Server) codeExchangeV1(ctx context.Context, client *Client, req *oidc.A
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if authReq.GetClientID() != client.client.ClientID {
|
||||
return nil, oidc.ErrInvalidClient().WithDescription("client_id does not correspond to the client_id in the authorization request")
|
||||
}
|
||||
|
||||
if challenge := authReq.GetCodeChallenge(); challenge != nil || client.AuthMethod() == oidc.AuthMethodNone {
|
||||
if err = op.AuthorizeCodeChallenge(req.CodeVerifier, challenge); err != nil {
|
||||
return nil, err
|
||||
@@ -121,6 +125,9 @@ func (s *Server) getAuthRequestV1ByID(ctx context.Context, id string) (*AuthRequ
|
||||
|
||||
func codeExchangeComplianceChecker(client *Client, req *oidc.AccessTokenRequest) command.AuthRequestComplianceChecker {
|
||||
return func(ctx context.Context, authReq *command.AuthRequestWriteModel) error {
|
||||
if authReq.ClientID != client.client.ClientID {
|
||||
return oidc.ErrInvalidClient().WithDescription("client_id does not correspond to the client_id in the authorization request")
|
||||
}
|
||||
if authReq.CodeChallenge != nil || client.AuthMethod() == oidc.AuthMethodNone {
|
||||
err := op.AuthorizeCodeChallenge(req.CodeVerifier, CodeChallengeToOIDC(authReq.CodeChallenge))
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user