add connected_at
This commit is contained in:
parent
3a70c5e767
commit
a555239514
@ -49,6 +49,8 @@ public class UsersEntity extends PanacheEntityBase {
|
||||
public LocalDateTime updated_at;
|
||||
@ColumnDefault("null")
|
||||
public LocalDateTime deleted_at;
|
||||
@ColumnDefault("null")
|
||||
public LocalDateTime connected_at;
|
||||
|
||||
public static UsersEntity findByPseudo(String pseudo){
|
||||
return find("pseudo", pseudo).firstResult();
|
||||
|
@ -2,6 +2,7 @@ package com.covas.Resources;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.ws.rs.CookieParam;
|
||||
@ -71,6 +72,8 @@ public class TokenRessource {
|
||||
// or create a JWT token encrypted using the 'A256KW' algorithm
|
||||
// Jwt.upn("alice").encryptWithSecret(secret);
|
||||
String nameEncoded = Base64.toBase64String(name.getBytes(StandardCharsets.UTF_8));
|
||||
users.connected_at = LocalDateTime.now();
|
||||
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();
|
||||
}
|
||||
// All mp.jwt and smallrye.jwt properties are still effective, only the verification key is customized.
|
||||
|
Loading…
x
Reference in New Issue
Block a user