Skip to content

Commit d15d7d5

Browse files
kellyma2CI Bot
authored andcommitted
Fix issues in existing client credentials change
This fixes two issues in the existing client credentials change: - client_credentials was not listed as a supported grant type - access tokens are not the storage ID Signed-off-by: Michael Kelly <[email protected]>
1 parent cc9b902 commit d15d7d5

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

server/handlers.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1130,7 +1130,13 @@ func (s *Server) handleClientCredentialsGrant(w http.ResponseWriter, r *http.Req
11301130

11311131
claims := storage.Claims{UserID: client.ID}
11321132

1133-
accessToken := storage.NewID()
1133+
accessToken, _, err := s.newAccessToken(r.Context(), client.ID, claims, scopes, nonce, "client")
1134+
if err != nil {
1135+
s.logger.ErrorContext(r.Context(), "failed to create new access token", "err", err)
1136+
s.tokenErrHelper(w, errServerError, err.Error(), http.StatusInternalServerError)
1137+
return
1138+
}
1139+
11341140
idToken, expiry, err := s.newIDToken(r.Context(), client.ID, claims, scopes, nonce, accessToken, "", "client")
11351141
if err != nil {
11361142
s.tokenErrHelper(w, errServerError, fmt.Sprintf("failed to create ID token: %v", err), http.StatusInternalServerError)

server/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy)
235235
grantTypeRefreshToken: true,
236236
grantTypeDeviceCode: true,
237237
grantTypeTokenExchange: true,
238+
grantTypeClientCredentials: true,
238239
}
239240
supportedRes := make(map[string]bool)
240241

0 commit comments

Comments
 (0)