is there any way to extract Keycloak Principal in spring boot 3 using oauth?
With older version we accessed like below,
KeycloakAuthenticationToken authentication;
try {
authentication =
(KeycloakAuthenticationToken) SecurityContextHolder.getContext().getAuthentication();
} catch (ClassCastException exception) {
throw new UnauthorizedException("Missing token");
}
Principal principal = (Principal) authentication.getPrincipal();