Organisation code avec commentaire

This commit is contained in:
Valentin CZERYBA 2022-05-15 17:08:00 +02:00
parent 1914022fda
commit 7aeb473d02

View File

@ -29,7 +29,19 @@ public class UsersRessources {
private static final Logger LOGGER = Logger.getLogger(UsersRessources.class); private static final Logger LOGGER = Logger.getLogger(UsersRessources.class);
@Inject @Inject
JsonWebToken jwt; JsonWebToken jwt;
///Function
private Boolean checkUserCookie(String userCookie, UsersEntity users){
String name = new String(Base64.decode(userCookie), StandardCharsets.UTF_8);
if(!name.equals(users.pseudo) && (!users.status)){
return false;
}
return true;
}
/// Appel HTTP
///GET
@GET @GET
@RolesAllowed("Admin") @RolesAllowed("Admin")
public Response getUsers(){ public Response getUsers(){
@ -73,11 +85,6 @@ public class UsersRessources {
} }
return Response.ok(new UserSingle(user.name, user.pseudo, user.firstName)).build(); return Response.ok(new UserSingle(user.name, user.pseudo, user.firstName)).build();
} }
private Boolean checkUserCookie(String userCookie, UsersEntity users){
String name = new String(Base64.decode(userCookie), StandardCharsets.UTF_8);
if(!name.equals(users.pseudo) && (!users.status)){
return false;
}
return true;
}
} }