Test users databse

This commit is contained in:
Valentin CZERYBA 2022-04-12 17:51:34 +02:00
parent 2202700bc7
commit 0b241bd8b5
3 changed files with 36 additions and 4 deletions

View File

@ -1,16 +1,20 @@
package com.covas;
import java.time.LocalDate;
import java.time.Month;
import java.util.Arrays;
import java.util.HashSet;
import javax.annotation.PostConstruct;
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.inject.Inject;
import javax.transaction.TransactionScoped;
import javax.transaction.Transactional;
import javax.ws.rs.CookieParam;
import javax.ws.rs.GET;
import javax.ws.rs.InternalServerErrorException;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
@ -32,8 +36,9 @@ public class TokenRessource {
@Inject
JsonWebToken jwt;
@Inject JWTParser parser;
@GET
@Path("authentificate")

View File

@ -0,0 +1,20 @@
package com.covas;
import java.time.LocalDate;
import javax.persistence.Entity;
import io.quarkus.hibernate.orm.panache.PanacheEntity;
@Entity
public class Users extends PanacheEntity {
public String name;
public LocalDate birth;
public Boolean status;
public static Users findByName(String name){
return find("name", name).firstResult();
}
}

View File

@ -1,6 +1,13 @@
smallrye.jwt.sign.key.location=privateKey.pem
mp.jwt.verify.publickey.location=publicKey.pem
mp.jwt.verify.issuer=https://example.com/issuer
mp.jwt.verify.issuer=https://example.com/issuer
quarkus.datasource.db-kind = postgresql
quarkus.datasource.username = toto
quarkus.datasource.password = toto
quarkus.datasource.jdbc.url = jdbc:postgresql://localhost:5432/toto
# drop and create the database at startup (use `update` to only update the schema)
quarkus.hibernate-orm.database.generation = drop-and-create