Created
May 28, 2020 05:58
-
-
Save pratikpc/3363a06a608bf95edbf1c022b01e4b71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GET | |
@Produces(MediaType.TEXT_PLAIN) | |
@PermitAll | |
public String hello(@Context SecurityContext securityContext) { | |
final var user = (DefaultJWTCallerPrincipal) securityContext.getUserPrincipal(); | |
if (user == null){ | |
return "Hello Anonymous User"; | |
} | |
final var email = user.getClaim("email"); | |
return "hello " + email; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment