[keycloak-dev] Override "native" Keycloak providers
Jerry Saravia
jerry.saravia at virginpulse.com
Mon Apr 1 08:53:05 EDT 2019
Hey guys,
Thank you for commenting.
@Stian, the default-provider option works well enough for times where native keycloak code doesn’t use a specific ID to request the provider.
However, for cases like the SAML provider as Thomas highlighted, it doesn’t work. I too had to change some of the SAML behavior such as the template that is used for errors and the way that some of the errors are handled.
I’ll be trying Thomas’ approach for now since it seems like it’ll help.
Jerry Saravia
Software Engineer
T(516) 603-6914
M516-603-6914
virginpulse.com
|virginpulse.com/global-challenge
492 Old Connecticut Path, Framingham, MA 01701, USA
Australia | Bosnia and Herzegovina | Brazil | Canada | Singapore | Switzerland | United Kingdom | USA
Confidentiality Notice: The information contained in this e-mail, including any attachment(s), is intended solely for use by the designated recipient(s). Unauthorized use, dissemination, distribution, or reproduction of this message by anyone other than the intended recipient(s), or a person designated as responsible for delivering such messages to the intended recipient, is strictly prohibited and may be unlawful. This e-mail may contain proprietary, confidential or privileged information. Any views or opinions expressed are solely those of the author and do not necessarily represent those of Virgin Pulse, Inc. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this e-mail message.
v2.50
From: Stian Thorgersen <sthorger at redhat.com>
Reply-To: "stian at redhat.com" <stian at redhat.com>
Date: Wednesday, March 27, 2019 at 20:35
To: Thomas Darimont <thomas.darimont at googlemail.com>
Cc: Jerry Saravia <jerry.saravia at virginpulse.com>, "keycloak-dev at lists.jboss.org" <keycloak-dev at lists.jboss.org>
Subject: Re: [keycloak-dev] Override "native" Keycloak providers
This email originates outside Virgin Pulse.
Instead of trying to deploy a custom provider with the same id as the default provider you can change the default provider for an SPI. In standalone.xml just set the default-provider for the SPI to your own. This will work when Keycloak doesn't specify directly what provider to get.
It was never supported to load a custom provider with same ID as the built-in providers. I believe that was a side-effect made possible when we introduced the ability to hot deploy providers.
On Wed, 27 Mar 2019 at 23:27, Thomas Darimont <thomas.darimont at googlemail.com<mailto:thomas.darimont at googlemail.com>> wrote:
Hello Jerry,
I encountered a similar problem with Keycloak 4.x when I needed to
implement my own SamlProtocolFactory to customize the SAML Message handling.
See: http://lists.jboss.org/pipermail/keycloak-dev/2019-February/011745.html<https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.jboss.org%2Fpipermail%2Fkeycloak-dev%2F2019-February%2F011745.html&data=02%7C01%7Cjerry.saravia%40virginpulse.com%7C29bb3f9e3749470e566e08d6b3154a33%7Cb123a16e892b4cf6a55a6f8c7606a035%7C0%7C0%7C636893301422983083&sdata=3K3gjAOMGUwncJ7qMQ%2F8t62AQ67atSu9POMe67Y5m8g%3D&reserved=0>
The only way I could get this to work was to add my custom extension jar to
the module.xml of the keycloak-services module,
see the link for details.
It's by far not the best solution, but at least it works.
Cheers,
Thomas
On Wed, 27 Mar 2019 at 22:28, Jerry Saravia <jerry.saravia at virginpulse.com<mailto:jerry.saravia at virginpulse.com>>
wrote:
> Hello,
>
>
>
> We’ve been using version 3.4.3 for a while now and are attempting to
> upgrade to 4.8 and we’ve run into some issues.
>
>
>
> Summary: We have created our own providers with the same PROVIDER_ID as
> some of the built in providers. For example, PasswordCredentialProvider has
> a provider id of “keycloak-password” and we created our own with the same
> id that gets loaded after the native one. This worked because in 3.4.3
> providers that were using the same id would still have their factories
> added to the factory map.
>
>
>
> See this link here for 3.4.3 changes:
>
>
> https://github.com/keycloak/keycloak/blob/3.4.3.Final/services/src/main/java/org/keycloak/provider/ProviderManager.java#L96-L100<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkeycloak%2Fkeycloak%2Fblob%2F3.4.3.Final%2Fservices%2Fsrc%2Fmain%2Fjava%2Forg%2Fkeycloak%2Fprovider%2FProviderManager.java%23L96-L100&data=02%7C01%7Cjerry.saravia%40virginpulse.com%7C29bb3f9e3749470e566e08d6b3154a33%7Cb123a16e892b4cf6a55a6f8c7606a035%7C0%7C0%7C636893301422993096&sdata=6bOZewlq0eMb7L5jgGU8OcdJoj5CLkBKEGKscHXSC4M%3D&reserved=0>
>
>
>
> These are the 4.8 changes
>
>
> https://github.com/keycloak/keycloak/blob/4.8.3.Final/services/src/main/java/org/keycloak/provider/ProviderManager.java#L96-L99<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fkeycloak%2Fkeycloak%2Fblob%2F4.8.3.Final%2Fservices%2Fsrc%2Fmain%2Fjava%2Forg%2Fkeycloak%2Fprovider%2FProviderManager.java%23L96-L99&data=02%7C01%7Cjerry.saravia%40virginpulse.com%7C29bb3f9e3749470e566e08d6b3154a33%7Cb123a16e892b4cf6a55a6f8c7606a035%7C0%7C0%7C636893301423003105&sdata=tOzksl43mTvHNFOpwDR2GVJdV1UcgpC5ASNq9FG4K0s%3D&reserved=0>
>
>
>
> In 4.8, the fully qualified class name (FQCN) is not longer used. Instead
> it uses the provider id and the spi name. I can no longer use the same
> PROVIDER_ID as the native providers to ‘override’ them, but sometimes there
> is code that gets the provider specifically by id. For example, in the
> UpdatePassword required action we have this:
>
>
>
> PasswordCredentialProvider passwordProvider =
> (PasswordCredentialProvider)context.getSession().getProvider(CredentialProvider.class,
> PasswordCredentialProviderFactory.PROVIDER_ID);
>
>
>
> In 3.4.3 because our provider was loaded we were able to inject into code
> that normally isn’t overridable. We did the same for the
> OIDCLoginProtocolFactory to alter some token endpoint behavior even the
> UpdatePassword required action itself rather than making a brand new
> required action that is a “second rate” because it isn’t native to Keycloak.
>
>
>
> Is there a solution for this in 4.8.3? I see this change was made in
> 4.0.0.Beta1 according to some of the history.
>
>
>
> J
>
>
> Jerry Saravia
> Software Engineer
> T(516) 603-6914
> M516-603-6914
> virginpulse.com<https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvirginpulse.com&data=02%7C01%7Cjerry.saravia%40virginpulse.com%7C29bb3f9e3749470e566e08d6b3154a33%7Cb123a16e892b4cf6a55a6f8c7606a035%7C0%7C0%7C636893301423003105&sdata=3yp0HaDcuQbZOFP1YvDNYLNzm%2Bo1hpAt8zRgVS7eJ8o%3D&reserved=0>
> |virginpulse.com/global-challenge<https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvirginpulse.com%2Fglobal-challenge&data=02%7C01%7Cjerry.saravia%40virginpulse.com%7C29bb3f9e3749470e566e08d6b3154a33%7Cb123a16e892b4cf6a55a6f8c7606a035%7C0%7C0%7C636893301423013114&sdata=Vx2gyBFI0DaPSoAjof7PQmwqX59pnQ54jelBdf5sljU%3D&reserved=0>
> 492 Old Connecticut Path, Framingham, MA 01701, USA
> Australia | Bosnia and Herzegovina | Brazil | Canada | Singapore |
> Switzerland | United Kingdom | USA
> Confidentiality Notice: The information contained in this e-mail,
> including any attachment(s), is intended solely for use by the designated
> recipient(s). Unauthorized use, dissemination, distribution, or
> reproduction of this message by anyone other than the intended
> recipient(s), or a person designated as responsible for delivering such
> messages to the intended recipient, is strictly prohibited and may be
> unlawful. This e-mail may contain proprietary, confidential or privileged
> information. Any views or opinions expressed are solely those of the author
> and do not necessarily represent those of Virgin Pulse, Inc. If you have
> received this message in error, or are not the named recipient(s), please
> immediately notify the sender and delete this e-mail message.
> v2.48
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org<mailto:keycloak-dev at lists.jboss.org>
> https://lists.jboss.org/mailman/listinfo/keycloak-dev<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.jboss.org%2Fmailman%2Flistinfo%2Fkeycloak-dev&data=02%7C01%7Cjerry.saravia%40virginpulse.com%7C29bb3f9e3749470e566e08d6b3154a33%7Cb123a16e892b4cf6a55a6f8c7606a035%7C0%7C0%7C636893301423013114&sdata=UqTmjXMSUeW2DRQjt%2Bkb2HJdYAgXNXuJcoJz8UNwmKg%3D&reserved=0>
_______________________________________________
keycloak-dev mailing list
keycloak-dev at lists.jboss.org<mailto:keycloak-dev at lists.jboss.org>
https://lists.jboss.org/mailman/listinfo/keycloak-dev<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.jboss.org%2Fmailman%2Flistinfo%2Fkeycloak-dev&data=02%7C01%7Cjerry.saravia%40virginpulse.com%7C29bb3f9e3749470e566e08d6b3154a33%7Cb123a16e892b4cf6a55a6f8c7606a035%7C0%7C0%7C636893301423023127&sdata=5M2GH13u6bZDqnNscCfpdWlnvDWctdTR41wuWVpkcbE%3D&reserved=0>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image549556.png
Type: image/png
Size: 681 bytes
Desc: image549556.png
Url : http://lists.jboss.org/pipermail/keycloak-dev/attachments/20190401/7e1948cf/attachment-0003.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image164323.png
Type: image/png
Size: 687 bytes
Desc: image164323.png
Url : http://lists.jboss.org/pipermail/keycloak-dev/attachments/20190401/7e1948cf/attachment-0004.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image344808.png
Type: image/png
Size: 757 bytes
Desc: image344808.png
Url : http://lists.jboss.org/pipermail/keycloak-dev/attachments/20190401/7e1948cf/attachment-0005.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image241394.jpg
Type: image/jpeg
Size: 24939 bytes
Desc: image241394.jpg
Url : http://lists.jboss.org/pipermail/keycloak-dev/attachments/20190401/7e1948cf/attachment-0001.jpg
More information about the keycloak-dev
mailing list