Skip to content

Commit

Permalink
Fix issues in existing client credentials change
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
kellyma2 authored and CI Bot committed Feb 19, 2025
1 parent 2fd2e15 commit 9db1d02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,13 @@ func (s *Server) handleClientCredentialsGrant(w http.ResponseWriter, r *http.Req

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

accessToken := storage.NewID()
accessToken, _, err := s.newAccessToken(r.Context(), client.ID, claims, scopes, nonce, "client")
if err != nil {
s.logger.ErrorContext(r.Context(), "failed to create new access token", "err", err)
s.tokenErrHelper(w, errServerError, err.Error(), http.StatusInternalServerError)
return
}

idToken, expiry, err := s.newIDToken(r.Context(), client.ID, claims, scopes, nonce, accessToken, "", "client")
if err != nil {
s.tokenErrHelper(w, errServerError, fmt.Sprintf("failed to create ID token: %v", err), http.StatusInternalServerError)
Expand Down
1 change: 1 addition & 0 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy)
grantTypeRefreshToken: true,
grantTypeDeviceCode: true,
grantTypeTokenExchange: true,
grantTypeClientCredentials: true,
}
supportedRes := make(map[string]bool)

Expand Down

0 comments on commit 9db1d02

Please sign in to comment.