I work with springboot and use oath2 (JWT). My token is the next
I want to get the payload from a controller or a filter but i dont know how.
I try this but it doesn't work
@GetMapping("/user")
public String getB(@AuthenticationPrincipal Jwt principal, @RequestHeader("refresh") String refresh) {
System.out.println(principal.getClaims());;
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
Object details = authentication.getDetails();
if ( details instanceof OAuth2AuthenticationDetails ){
OAuth2AuthenticationDetails oAuth2AuthenticationDetails = (OAuth2AuthenticationDetails)details;
Map<String, Object> decodedDetails = (Map<String, Object>)oAuth2AuthenticationDetails.getDecodedDetails();
System.out.println( decodedDetails.get("time_created") );
}