[keycloak-user] Username Password Form as Alternative
Nalyvayko, Peter
pnalyvayko at agi.com
Wed Aug 10 21:26:36 EDT 2016
Hi Filipe,
I have a similar use case where Username Form is a fallback option, and I am able to skip the login page by setting the user and returning the success flow status.
The custom authenticator sets the user upon success and updates the flow context status, i.e.:
...
context.setUser(user);
context.success();
return;
...
Attached is the custom browser authentication flow screenshot.
Hope it helps
Regards,
Peter
________________________________________
From: keycloak-user-bounces at lists.jboss.org [keycloak-user-bounces at lists.jboss.org] on behalf of Filipe Lautert [filipelautert at gmail.com]
Sent: Wednesday, August 10, 2016 4:02 PM
To: keycloak-user at lists.jboss.org
Subject: [keycloak-user] Username Password Form as Alternative
Hello
I would like to have the "Username Password Form" auth type as a fallback option - I've setup my personalized auth methods, but if they don't succeed I wan't the user to be shown the login form.
The issue that I face is that even when I authenticate the user successfully (in my Authenticator code with context.setUser(myUser); context.success(); ) the login form is still shown to the user, even if it's inside a auth type "Browser Forms" set up as alternative.
I worked around it creating a class called AlternativeUsernamePasswordFormFactory that extends UsernamePasswordFormFactory, and the only change that I did to it was to add the AuthenticationExecutionModel.Requirement.ALTERNATIVE to the REQUIREMENT_CHOICES . Now, if I set this new auth type as alternative in Keycloak, it does what I want.
So my questions are: am I missing something to mark my Authenticator as sufficient to end the flow and return to the client? if not, is there a reason why UsernamePasswordFormFactory doesn't provide the ALTERNATIVE option, and can I suggest a patch to add it to this class?
Cheers
filipe
--
filipe lautert
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Keycloak-browser-flow.png
Type: image/png
Size: 49587 bytes
Desc: Keycloak-browser-flow.png
Url : http://lists.jboss.org/pipermail/keycloak-user/attachments/20160811/b02c3e5b/attachment-0001.png
More information about the keycloak-user
mailing list