[keycloak-dev] Retrieving the current logged in username

Bruno Oliveira bruno at abstractj.org
Mon Jun 9 22:33:03 EDT 2014


Thanks Bill and Stan.

This is what I've been trying to do[1]. Unfortunately after a user is
successfully authenticated the method ".getUserPrincipal" returns null.

I saw an issue reported with old versions of Resteasy[2], but the NPE persists even
after upgrade the project to the latest version.

[1] - https://github.com/abstractj/aerogear-unifiedpush-server/commit/de1f50370f4c339ad394b94def377a4c0072988b#diff-2ab40ceec347387de26ff2d7cab8ecb3R56
[2] - https://issues.jboss.org/browse/AS7-3227

On 2014-06-09, Stan Silvert wrote:
> You are probably looking for KeycloakSecurityContext.getToken().getPreferredUsername()?
>
>
> On 6/9/2014 5:39 PM, Bruno Oliveira wrote:
> > Good morning guys,
> >
> > Which way is the best to retrieve the current logged in username? I'm
> > trying with KeycloakSecurityContext, but no luck.
> >
> > Thanks in advance.
> >
> > --
> >
> > abstractj
> > _______________________________________________
> > keycloak-dev mailing list
> > keycloak-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/keycloak-dev
>
> _______________________________________________
> keycloak-dev mailing list
> keycloak-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-dev

--

abstractj


More information about the keycloak-dev mailing list