Skip to content

Commit e9f07b5

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 <mkelly@arista.com>
1 parent be3175b commit e9f07b5

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

server/handlers.go

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

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

1079-
accessToken := storage.NewID()
1079+
accessToken, err := s.newAccessToken(client.ID, claims, scopes, nonce, "client")
1080+
if err != nil {
1081+
s.logger.Errorf("failed to create new access token: %v", err)
1082+
s.tokenErrHelper(w, errServerError, err.Error(), http.StatusInternalServerError)
1083+
return
1084+
}
1085+
10801086
idToken, expiry, err := s.newIDToken(client.ID, claims, scopes, nonce, accessToken, "", "client")
10811087
if err != nil {
10821088
s.tokenErrHelper(w, errServerError, fmt.Sprintf("failed to create ID token: %v", err), http.StatusInternalServerError)

server/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func newServer(ctx context.Context, c Config, rotationStrategy rotationStrategy)
213213
c.SupportedResponseTypes = []string{responseTypeCode}
214214
}
215215

216-
supportedGrant := []string{grantTypeAuthorizationCode, grantTypeRefreshToken, grantTypeDeviceCode} // default
216+
supportedGrant := []string{grantTypeAuthorizationCode, grantTypeRefreshToken, grantTypeDeviceCode, grantTypeClientCredentials} // default
217217
supportedRes := make(map[string]bool)
218218

219219
for _, respType := range c.SupportedResponseTypes {

0 commit comments

Comments
 (0)