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

Allow existing mappers for Custom Identity Providers #21154

Closed
danielFesenmeyer opened this issue Jun 22, 2023 · 3 comments · Fixed by #22848
Closed

Allow existing mappers for Custom Identity Providers #21154

danielFesenmeyer opened this issue Jun 22, 2023 · 3 comments · Fixed by #22848
Assignees
Labels
area/identity-brokering kind/enhancement Categorizes a PR related to an enhancement
Milestone

Comments

@danielFesenmeyer
Copy link
Contributor

Description

Currently, for each IDP Mapper, the list of supported mappers is defined by the method IdentityProviderMapper#getCompatibleProviders():

For example, for UserAttributeMapper, the compatible providers are the Keycloak OIDC Provider and the standard OIDC Provider.
https://github.com/keycloak/keycloak/blob/41e253c054d7db1682a0865603bdf20d0893ba6f/services/src/main/java/org/keycloak/broker/oidc/mappers/UserAttributeMapper.java#LL48C1-L48C1

We have implemented our own Azure OIDC Provider, based on the standard OIDC Provider, and our customers would like to use (probably) all of the mappers which are compatible to the standard OIDC Provider.
Currently this is not easily possible. One of those mappers is UserAttributeMapper.

Discussion

No response

Motivation

We have built a kind of patch, which supports all mappers for our custom provider, which are supported by the standard provider.
It would be helpful if we could do this without patching Keycloak.

Details

No response

@mposolda
Copy link
Contributor

@danielFesenmeyer It would be ideal:

  1. When someone implements custom IdentityProviderMapper, he can easily specify which IdentityProvider implementations it supports.
  2. When someone implements custom IdentityProvider, he can easily specify which IdentityProviderMapper are compatible with it

Currently Keycloak is optimized for (1), but doesn't allow (2).

How to improve that?

I am thinking about something like this method on IdentityPRovider:

boolean default isSupported(IdentityProviderMapper mapper) {
    List<String> compatibleIdps = mapper.getCompatibleProviders();
    return compatibleIdps.contains(IdentityProviderMapper.ANY_PROVIDER) || compatibleIdps.contains(this.getConfig().getProviderId());
}

And update accordingly IdentityProviderMapper.getMapperTypes() to be able to consume that method.

I think this approach will allow both (1) and (2) if I don't miss anything?

Contribution welcome :-)

@danielFesenmeyer
Copy link
Contributor Author

danielFesenmeyer commented Aug 18, 2023

@mposolda I think it will work that way. I'll provide a PR.

danielFesenmeyer added a commit to bosch-io/keycloak that referenced this issue Aug 22, 2023
- Also allows to use existing mappers for custom Identity Providers without having to change those mappers

Closes keycloak#21154
danielFesenmeyer added a commit to bosch-io/keycloak that referenced this issue Aug 22, 2023
- Also allows to use existing mappers for custom Identity Providers without having to change those mappers

Closes keycloak#21154
danielFesenmeyer added a commit to bosch-io/keycloak that referenced this issue Aug 31, 2023
- Also allows to use existing mappers for custom Identity Providers without having to change those mappers

Closes keycloak#21154
@danielFesenmeyer
Copy link
Contributor Author

Hi @mposolda,

I've implemented a PR based on your suggestion: #22848

danielFesenmeyer added a commit to bosch-io/keycloak that referenced this issue Aug 31, 2023
- Also allows to use existing mappers for custom Identity Providers without having to change those mappers

Closes keycloak#21154
sschu pushed a commit to bosch-io/keycloak that referenced this issue Sep 12, 2023
- Also allows to use existing mappers for custom Identity Providers without having to change those mappers

Closes keycloak#21154
sschu pushed a commit to bosch-io/keycloak that referenced this issue Sep 13, 2023
- Also allows to use existing mappers for custom Identity Providers without having to change those mappers

Closes keycloak#21154
sschu pushed a commit to bosch-io/keycloak that referenced this issue Sep 13, 2023
- Also allows to use existing mappers for custom Identity Providers without having to change those mappers

Closes keycloak#21154
@pedroigor pedroigor self-assigned this Sep 13, 2023
@pedroigor pedroigor added this to the 23.0.0 milestone Sep 13, 2023
pedroigor pushed a commit that referenced this issue Sep 13, 2023
- Also allows to use existing mappers for custom Identity Providers without having to change those mappers

Closes #21154
srose pushed a commit to srose/keycloak that referenced this issue Dec 20, 2023
- Also allows to use existing mappers for custom Identity Providers without having to change those mappers

Closes keycloak#21154
kamontat pushed a commit to kamontat/keycloak that referenced this issue Jan 20, 2024
- Also allows to use existing mappers for custom Identity Providers without having to change those mappers

Closes keycloak#21154

Signed-off-by: Kamontat Chantrachirathumrong <14089557+kamontat@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment