Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. @GET
  2. @Path("/{token}")
  3. @Produces(MediaType.APPLICATION_JSON)
  4. public Response whoiam(@PathParam("token") String token)
  5. {
  6. Claims claims = null;
  7. try{
  8. //This line will throw an exception if it is not a signed JWS (as expected)
  9. claims = Jwts.parser()
  10. .setSigningKey(DatatypeConverter.parseBase64Binary(key))
  11. .parseClaimsJws(token).getBody();
  12. return Response.status(200).entity(claims.getId()).build();
  13. }
  14. catch(Exception e){
  15. return null;
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement