How do you retrieve the principal ?
Something like this ?
@RequestMapping(value = "/admin", method = RequestMethod.GET)
public String handleAdminRequest(Principal principal, Model model) {
model.addAttribute("principal", principal);
return "admin";
}
On Thu, Dec 15, 2016 at 5:17 PM, Ondra Pala <pala.ondra(a)gmail.com> wrote:
This attribute I has set ....
2016-12-15 17:11 GMT+01:00 Sebastien Blanc <sblanc(a)redhat.com>:
> Set "principal-attribute":"preferred_username" in your
keycloak.json and
> you should be able to get your username from the Principal object.
>
>
> On Thu, Dec 15, 2016 at 4:53 PM, Ondra Pala <pala.ondra(a)gmail.com> wrote:
>
>> Hello,
>>
>> Why I can“t get username of logged user? I can try get this information
>> from Principal, HttpServletResponse ... but still null.
>>
>> Our application use for authentification Keycloak, after successfull
>> login,
>> user is redirect to another url (on the same server) in Java Spring MVC
>> application.
>>
>> Thanks for your answers.
>>
>> Ondra
>> _______________________________________________
>> keycloak-user mailing list
>> keycloak-user(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/keycloak-user
>
>
>