Re-organisation des packages
This commit is contained in:
parent
268ee6e277
commit
205f8471bf
@ -1,4 +1,4 @@
|
|||||||
package com.covas;
|
package com.covas.ApplicationScoped;
|
||||||
|
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
@ -14,6 +14,9 @@ import javax.enterprise.event.Observes;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
import com.covas.Entity.UsersEntity;
|
||||||
|
import com.covas.Enums.Roles;
|
||||||
|
|
||||||
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
import org.eclipse.microprofile.config.inject.ConfigProperty;
|
||||||
|
|
||||||
|
|
||||||
@ -29,8 +32,8 @@ public class ApplicationLifeCycle {
|
|||||||
void onStart(@Observes StartupEvent ev) {
|
void onStart(@Observes StartupEvent ev) {
|
||||||
LOGGER.info("The application has started");
|
LOGGER.info("The application has started");
|
||||||
if (schemaCreate){
|
if (schemaCreate){
|
||||||
Users users = new Users();
|
UsersEntity users = new UsersEntity();
|
||||||
Users users2 = new Users();
|
UsersEntity users2 = new UsersEntity();
|
||||||
|
|
||||||
|
|
||||||
if(users.findByPseudo("Peter") == null){
|
if(users.findByPseudo("Peter") == null){
|
@ -1,21 +1,20 @@
|
|||||||
package com.covas;
|
package com.covas.Entity;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
import com.covas.Enums.Roles;
|
||||||
|
|
||||||
import org.hibernate.annotations.ColumnDefault;
|
import org.hibernate.annotations.ColumnDefault;
|
||||||
|
|
||||||
import io.quarkus.hibernate.orm.panache.PanacheEntity;
|
import io.quarkus.hibernate.orm.panache.PanacheEntity;
|
||||||
|
|
||||||
enum Roles {
|
|
||||||
User,
|
|
||||||
Admin
|
|
||||||
}
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Users extends PanacheEntity {
|
@Table(name = "users")
|
||||||
|
public class UsersEntity extends PanacheEntity {
|
||||||
|
|
||||||
@Column(nullable = false, unique = true)
|
@Column(nullable = false, unique = true)
|
||||||
public String pseudo;
|
public String pseudo;
|
||||||
@ -34,7 +33,7 @@ public class Users extends PanacheEntity {
|
|||||||
|
|
||||||
public Roles roles;
|
public Roles roles;
|
||||||
|
|
||||||
public static Users findByPseudo(String pseudo){
|
public static UsersEntity findByPseudo(String pseudo){
|
||||||
return find("pseudo", pseudo).firstResult();
|
return find("pseudo", pseudo).firstResult();
|
||||||
}
|
}
|
||||||
|
|
9
src/main/java/com/covas/Enums/Roles.java
Normal file
9
src/main/java/com/covas/Enums/Roles.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package com.covas;
|
||||||
|
|
||||||
|
public enum Roles {
|
||||||
|
User,
|
||||||
|
Admin;
|
||||||
|
Roles(){
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.covas;
|
package com.covas.Json;
|
||||||
|
|
||||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.covas;
|
package com.covas.Json;
|
||||||
|
|
||||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.covas;
|
package com.covas.Json;
|
||||||
|
|
||||||
import io.quarkus.runtime.annotations.RegisterForReflection;
|
import io.quarkus.runtime.annotations.RegisterForReflection;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.covas;
|
package com.covas.Resources;
|
||||||
|
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
@ -1,4 +1,4 @@
|
|||||||
package com.covas;
|
package com.covas.Resources;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
@ -11,6 +11,8 @@ import javax.ws.rs.Produces;
|
|||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
import com.covas.Json.Hello;
|
||||||
|
|
||||||
@Consumes(MediaType.APPLICATION_JSON)
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
@Path("/json")
|
@Path("/json")
|
@ -1,16 +1,11 @@
|
|||||||
package com.covas;
|
package com.covas.Resources;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.Month;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.annotation.security.PermitAll;
|
import javax.annotation.security.PermitAll;
|
||||||
import javax.annotation.security.RolesAllowed;
|
import javax.annotation.security.RolesAllowed;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.transaction.TransactionScoped;
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
import javax.ws.rs.CookieParam;
|
import javax.ws.rs.CookieParam;
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.InternalServerErrorException;
|
import javax.ws.rs.InternalServerErrorException;
|
||||||
@ -22,6 +17,9 @@ import javax.ws.rs.core.NewCookie;
|
|||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.SecurityContext;
|
import javax.ws.rs.core.SecurityContext;
|
||||||
|
|
||||||
|
import com.covas.Json.Jwt2;
|
||||||
|
import com.covas.Json.Token;
|
||||||
|
|
||||||
import io.smallrye.jwt.auth.principal.JWTParser;
|
import io.smallrye.jwt.auth.principal.JWTParser;
|
||||||
import io.smallrye.jwt.auth.principal.ParseException;
|
import io.smallrye.jwt.auth.principal.ParseException;
|
||||||
import io.smallrye.jwt.build.Jwt;
|
import io.smallrye.jwt.build.Jwt;
|
Loading…
x
Reference in New Issue
Block a user