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 Mar 22, 2022
1 parent c1862e3 commit f7a0f79
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,13 @@ func (s *Server) handleClientCredentialsGrant(w http.ResponseWriter, r *http.Req

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

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

idToken, expiry, err := s.newIDToken(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
7 changes: 6 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,12 @@ func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy)
supportedRes[respType] = true
}

supportedGrant := []string{grantTypeAuthorizationCode, grantTypeRefreshToken, grantTypeDeviceCode} // default
supportedGrant := []string{
grantTypeAuthorizationCode,
grantTypeRefreshToken,
grantTypeDeviceCode,
grantTypeClientCredentials,
} // default
if c.PasswordConnector != "" {
supportedGrant = append(supportedGrant, grantTypePassword)
}
Expand Down

0 comments on commit f7a0f79

Please sign in to comment.