Kenmegne
7 days ago 23a46b4be35277e06ec89f48730eeb694e686be8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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);
    
}