Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @GET
- @Path("/{token}")
- @Produces(MediaType.APPLICATION_JSON)
- public Response whoiam(@PathParam("token") String token)
- {
- Claims claims = null;
- try{
- //This line will throw an exception if it is not a signed JWS (as expected)
- claims = Jwts.parser()
- .setSigningKey(DatatypeConverter.parseBase64Binary(key))
- .parseClaimsJws(token).getBody();
- return Response.status(200).entity(claims.getId()).build();
- }
- catch(Exception e){
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement