File tree Expand file tree Collapse file tree
src/main/java/com/okta/developer/jugtours/web Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,16 +25,11 @@ public class UserController {
2525 String issuerUri ;
2626
2727 @ GetMapping ("/api/user" )
28- public ResponseEntity <?> getUser (Principal principal ) {
29- if (principal == null ) {
28+ public ResponseEntity <?> getUser (@ AuthenticationPrincipal OAuth2User user ) {
29+ if (user == null ) {
3030 return new ResponseEntity <>("" , HttpStatus .OK );
31- }
32- if (principal instanceof OAuth2AuthenticationToken ) {
33- OAuth2User authentication = ((OAuth2AuthenticationToken ) principal ).getPrincipal ();
34- Map <String , Object > details = authentication .getAttributes ();
35- return ResponseEntity .ok ().body (details );
3631 } else {
37- return ResponseEntity .ok ().body (principal . getName ());
32+ return ResponseEntity .ok ().body (user . getAttributes ());
3833 }
3934 }
4035
You can’t perform that action at this time.
0 commit comments