fix hashing 512
This commit is contained in:
parent
a21210935b
commit
77e473442e
@ -1,6 +1,5 @@
|
||||
package com.covas.Entity;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDate;
|
||||
|
||||
import javax.persistence.Column;
|
||||
@ -39,6 +38,7 @@ public class UsersEntity extends PanacheEntity {
|
||||
}
|
||||
|
||||
public static void add(String pseudo, String email, String name, String firstName, LocalDate birth, String password, String roles){
|
||||
|
||||
UsersEntity users = new UsersEntity();
|
||||
users.pseudo = pseudo;
|
||||
users.email = email;
|
||||
@ -46,7 +46,7 @@ public class UsersEntity extends PanacheEntity {
|
||||
users.firstName = firstName;
|
||||
users.birth = birth;
|
||||
users.status = false;
|
||||
users.password = Hash.encryptSHA512(new String(password.getBytes(), StandardCharsets.UTF_8));
|
||||
users.password = Hash.encryptSHA512(password);
|
||||
users.roles = roles;
|
||||
users.persist();
|
||||
}
|
||||
|
@ -53,14 +53,14 @@ public class TokenRessource {
|
||||
if (jwtCookie == null) {
|
||||
String[] hash = new String(Base64.decode(auth.split(" ")[1]), StandardCharsets.UTF_8).split(":");
|
||||
String pseudo = hash[0];
|
||||
LOGGER.info(hash[1].length());
|
||||
password = Hash.encryptSHA512(Hash.encryptSHA512(hash[1]));
|
||||
password = Hash.encryptSHA512(hash[1]);
|
||||
|
||||
UsersEntity users = UsersEntity.findByPseudo(pseudo);
|
||||
if(users != null){
|
||||
|
||||
}
|
||||
|
||||
LOGGER.info(users.password);
|
||||
LOGGER.info(password);
|
||||
|
||||
|
||||
// Create a JWT token signed using the 'HS256' algorithm
|
||||
String newJwtCookie = Jwt.issuer("https://example.com/issuer").upn("Alice").groups(new HashSet<>(Arrays.asList("User"))).sign();
|
||||
// or create a JWT token encrypted using the 'A256KW' algorithm
|
||||
|
Loading…
x
Reference in New Issue
Block a user