[keycloak-user] How to retrieve user ID from Keycloak to my web app
Marek Posolda
mposolda at redhat.com
Wed Dec 5 03:36:52 EST 2018
If you just authenticated the user and you're using Keycloak servlet
adapter, you can just get the ID of authenticated user by calling
servletRequest.getRemoteUser() . You can even retrieve the other claims
besides user ID. For example email, firstName, lastName etc. It's
possible to get them from the token, I suggest to take a look at our
quickstart and documentation for more details.
Marek
On 27/11/2018 05:22, Kunal Kumar wrote:
> Before, my web app is has its own login form to authenticate users.
>
> But since I have connected my web app to Keycloak to authenticate the users
> now, my web app does not need to have the login form anymore, hence I need
> to remove it.
>
> This was roughly how I retrieved the users information before Keycloak:-
>
> if (chkLogin(getUserID(), getUserPwd())) {
> MaintainUser mu = new MaintainUser();
> this.usrInfo = null;
> String[] usr = mu.validatePassword(getUserID(), getUserPwd()); }
>
> This is not the full coding, but basically I use the getUserID method to
> retrieve the users info and check it for authentication before. How do I
> perform this if I want to retrieve the user ID from the Keycloak admin
> console?
>
>
> Regards,
>
> Kunal Kumar
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
More information about the keycloak-user
mailing list