add transactionnal

This commit is contained in:
Valentin CZERYBA 2022-08-11 21:35:02 +02:00
parent 6a7e8b0563
commit a147315851

View File

@ -77,14 +77,14 @@ public class TokenRessource {
users.connected_at = LocalDateTime.now(); users.connected_at = LocalDateTime.now();
users.persist(); users.persist();
return Response.status(Response.Status.CREATED).cookie(new NewCookie(new Cookie("jwt", newJwtCookie), "Token JWT", expires, false), new NewCookie(new Cookie("user", nameEncoded), "Username", expires, false)).build(); return Response.status(Response.Status.CREATED).cookie(new NewCookie(new Cookie("jwt", newJwtCookie), "Token JWT", expires, false), new NewCookie(new Cookie("user", nameEncoded), "Username", expires, false)).build();
} }
// All mp.jwt and smallrye.jwt properties are still effective, only the verification key is customized. // All mp.jwt and smallrye.jwt properties are still effective, only the verification key is customized.
try { try {
jwt = parser.parse(jwtCookie); jwt = parser.parse(jwtCookie);
} }
catch(ParseException p){ catch(ParseException p){
return Response.status(Response.Status.GONE).build(); return Response.status(Response.Status.GONE).build();
} }
// or jwt = parser.decrypt(jwtCookie, secret); // or jwt = parser.decrypt(jwtCookie, secret);
String kid = jwt.getClaim(Claims.kid).toString(); String kid = jwt.getClaim(Claims.kid).toString();
if(!kid.equals(users.id.toString())){ if(!kid.equals(users.id.toString())){