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

BUG: OIDC Azure provider - when le groups returned in the claim is not a list #1276

Closed
KabRevel opened this issue Nov 21, 2022 · 3 comments
Closed

Comments

@KabRevel
Copy link

KabRevel commented Nov 21, 2022

When the token returned by oidc provider is like :

{
......
"custom:groupList": [
<my_custom_group>
],
"custom:group": <my_custom_group>
"exp":
...
}

The mapping of oidc groups and akhq groups is not working if the groups-fields is not a List.

For the example given above :

This configuration will WORK

oidc:
  enabled: true
  providers:
    cognito:
      label: "Login with oidc"
	  groups-field: custom:groupList   
      groups:
        - name: <my_custom_group>
          groups:
            - admin

But this Does not WORK

oidc:
  enabled: true
  providers:
    cognito:
      label: "Login with oidc"
	  groups-field: custom:group   
      groups:
        - name: <my_custom_group>
          groups:
            - admin

After investigation , le pb comes from this function

protected List<String> getOidcGroups(Oidc.Provider provider, OpenIdClaims openIdClaims) {
        List<String> groups = new ArrayList<>();
        if (openIdClaims.contains(provider.getGroupsField())) {
            Object groupsField = openIdClaims.get(provider.getGroupsField());
            if (groupsField instanceof Collection) {
                groups = ((Collection<Object>) groupsField)
                        .stream()
                        .map(Objects::toString)
                        .collect(Collectors.toList());
            }
        }
        return groups;
    }

why are we verifying "groupsField instanceof Collection" ?? It should be a List or a Single element.

@tchiotludo
Copy link
Owner

is this is not the same than this PR: #1263 ?

@KabRevel
Copy link
Author

Hi @tchiotludo , yes its the same case. It is possible to release this fix ?

@tchiotludo
Copy link
Owner

done in #1263

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants