Repository navigation
Cannot get a custom Identity Provider to work #14514
luciano-fiandesio
started this conversation in
Archive
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hello, I have been trying to integrate an Identity Provider with KC (19.0.1, Quarkus) without success and I'm running out of options, hope that someone can support me.
The Identity Provider is an IBM product, called Webseal. This IP simply presents a login page and, upon successful authentication, it returns the username of the logged-in user in the
Responseheader.My approach
I have created a fairly simple Identity Provider, which essentially has two methods:
performLogin()callback()Note that the URL also contains the KC cookies
AUTH_SESSION_ID,KC_RESTARTandAUTH_SESSION_ID_LEGACYwhich I'm passing to Webseal as query params, so that Webseal can return them in the response as cookies (Not sure this is the right approach).The
WebSealEndpointclass has one method:Within Keycloak, I have "cloned" the
Browserflow and set theIdentity Provider Redirectorto use my custom IDP.Then, I created a new
Clientand used the custom flow to replace the standardBrowserflow - the main use case here is to protect a React app.Testing the setup
From the React app (configured to use keycloak.js) I'm correctly redirected to the Webseal login page.
On successful login, I'm redirected to the endpoint (
Redirect URI) specified on the custom Identity Provider page. And that's where I'm encountering problems.When the redirect kicks in, the method
done()(see above) is triggered. I have tried several solutions based on snippets found mostly on Github, since there is basically 0 documentation.Solution 1
This code fails because the
authenticatedmethod expects a non-nullAuthenticationSessionModel.More specifically, line
514ofIdentityBrokerServicefails, because this call at line 496 returnsnull:AuthenticationSessionModel authenticationSession = context.getAuthenticationSession();Solution 2
Since it seems that I need an Authentication Session available, I tried the following:
This also fails, when calling
this.callback.getAndVerifyAuthenticationSession(id);This is what I'm seeing in the logs:
I have started KC in debug mode and stepped through the code, but I do not understand what is going on. The code ends up here:
In both solutions, I have to pass the Keycloak cookies back and forth. I wonder if this is even needed and if Keycloak can figure out the
session idin a different way.Any help or pointer would be very appreciated.
All reactions