Hi,
I have keyclick integrated into my application and have it protecting several end points.
A user can login to get access to the protected resources by adding the bearer token into
the authorisation header.
I was wondering what the recommended way is to actually identify the user who has
authenticated. Is this the way to do it?
@Context
private SecurityContext securityContext;
.
.
.
KeycloakPrincipal principal =
(KeycloakPrincipal)securityContext.getUserPrincipal();
logger.info("Logged in user: "+ principal.getName());
I noticed the the name is the ‘id’ of the user from the keycloak table.
Are there any other ways to get data from the token?
Thanks
Conrad