Skip to content

Commit 589f5f6

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 64d3967 commit 589f5f6

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
@@ -1046,7 +1046,13 @@ func (s *Server) handleClientCredentialsGrant(w http.ResponseWriter, r *http.Req
10461046

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

1049-
accessToken := storage.NewID()
1049+
accessToken, err := s.newAccessToken(client.ID, claims, scopes, nonce, "client")
1050+
if err != nil {
1051+
s.logger.Errorf("failed to create new access token: %v", err)
1052+
s.tokenErrHelper(w, errServerError, err.Error(), http.StatusInternalServerError)
1053+
return
1054+
}
1055+
10501056
idToken, expiry, err := s.newIDToken(client.ID, claims, scopes, nonce, accessToken, "", "client")
10511057
if err != nil {
10521058
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)