Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MGMT-16766: Use client_id instead of clientId #6076

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/auth/auth_handler_test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func GetTokenAndCert(withLateIat bool) (string, []byte) {
"email": "jdoe123@example.com",
"username": "jdoe123@example.com",
"is_org_admin": false,
"clientId": "1234",
"client_id": "1234",
}
if withLateIat {
mapClaims["iat"] = time.Now().Add(5 * time.Minute).Unix()
Expand Down
9 changes: 8 additions & 1 deletion pkg/auth/rhsso_authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,14 @@ func parseOCMPayload(userToken *jwt.Token) (*ocm.AuthPayload, error) {
payload.LastName, _ = claims["last_name"].(string)
payload.Organization, _ = claims["org_id"].(string)
payload.Email, _ = claims["email"].(string)
payload.ClientID, _ = claims["clientId"].(string)

// The `clientId` claim was replaced by `client_id` in order to be compliant with the OAuth2
// specification. We will still try to use the old `clientId` claim to support older
// environments where the change hasn't been made yet.
payload.ClientID, _ = claims["client_id"].(string)
if payload.ClientID == "" {
payload.ClientID, _ = claims["clientId"].(string)
}

// Check values, if empty, use alternative claims from RHD
if payload.Username == "" {
Expand Down