package com.megatim.fdxconsultation.service.ifaces.authentication;
|
|
import com.megatim.fdxcommons.core.ifaces.interceptor.LoggingInterceptorBinding;
|
import com.megatim.fdxconsultation.model.administration.User;
|
import com.megatim.fdxconsultation.model.authentification.LoginRequest;
|
import com.mgt.rs.security.core.common.Secured;
|
import com.mgt.rs.security.core.common.SecuredAdmin;
|
import com.mgt.rs.security.core.common.SecuredMegaAdmin;
|
import com.mgt.rs.security.core.common.SecuredSuperAdmin;
|
import javax.annotation.security.PermitAll;
|
import javax.ws.rs.Consumes;
|
import javax.ws.rs.GET;
|
import javax.ws.rs.POST;
|
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.HttpHeaders;
|
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.Response;
|
|
/**
|
*
|
* @author lenovo
|
*/
|
public interface AuthenticationRS {
|
|
/**
|
* Validate user credentials and issue a token for the user.
|
*
|
* @param loginRequest
|
* @return
|
*/
|
@POST
|
@Consumes({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
@PermitAll
|
@Path("login")
|
@LoggingInterceptorBinding(message = "Connexion de l'utilisateur [0.userName]")
|
public Response authenticate(LoginRequest loginRequest);
|
|
/**
|
* Permet de recuperer les informations de l'utilisateur.
|
*
|
* @param headers
|
* @param username
|
* @return
|
*/
|
@GET
|
@Consumes({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
@SecuredAdmin
|
@SecuredSuperAdmin
|
@SecuredMegaAdmin
|
@Path("info")
|
@Secured(action = "*")
|
public Response getInfoUser(@Context HttpHeaders headers);
|
|
/**
|
* Permet de savoir si un utilisateur avec le même username existe dejà
|
*
|
* @param headers
|
* @param username
|
* @return
|
*/
|
@GET
|
@Consumes({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
@Path("checkusername/{username}")
|
@Secured(action = "*")
|
@SecuredAdmin
|
@SecuredSuperAdmin
|
@SecuredMegaAdmin
|
public Response ifUserNameExist(@Context HttpHeaders headers, @PathParam("username") String username);
|
|
/**
|
* Permet de déconnecter l'utilisateur.
|
*
|
* @param headers
|
* @param entity
|
* @return
|
*/
|
@POST
|
@Consumes({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
@SecuredAdmin
|
@SecuredSuperAdmin
|
@SecuredMegaAdmin
|
@Path("logout")
|
@Secured(action = "*")
|
@LoggingInterceptorBinding(message = "Déconnexion de l'utilisateur [1.userName]")
|
public Response logout(@Context HttpHeaders headers, User entity);
|
|
/**
|
* Permet de générer les données de test
|
*
|
* @param headers
|
* @return
|
*/
|
@POST
|
@Consumes({MediaType.APPLICATION_JSON})
|
@Produces({MediaType.APPLICATION_JSON})
|
@SecuredAdmin
|
@SecuredSuperAdmin
|
@SecuredMegaAdmin
|
@Path("test")
|
@Secured(action="*")
|
public Response generateDataTotTest(@Context HttpHeaders headers);
|
|
}
|