1 package net.avcompris.commons3.core;
2
3 import javax.annotation.Nullable;
4
5 import net.avcompris.commons3.api.User;
6 import net.avcompris.commons3.api.UserSession;
7 import net.avcompris.commons3.api.UserSessions;
8 import net.avcompris.commons3.api.UserSessionsQuery;
9 import net.avcompris.commons3.api.exception.ServiceException;
10
11 public interface AuthService {
12
13 @Nullable
14 UserSessionsQuery validateUserSessionsQuery(String correlationId, User user,
15 @Nullable String q,
16 @Nullable String sort,
17 @Nullable Integer start,
18 @Nullable Integer limit,
19 @Nullable String expand
20 ) throws ServiceException;
21
22 UserSessions getUserSessions(String correlationId, User user,
23 @Nullable UserSessionsQuery query
24 ) throws ServiceException;
25
26 @Nullable
27 User getAuthenticatedUser(@Nullable String authorization, @Nullable String userSessionId) throws ServiceException;
28
29 @Nullable
30 UserSession authenticate(String correlationId, String username, String password) throws ServiceException;
31
32 void setLastActiveAt(String correlationId, User user) throws ServiceException;
33
34 UserSession getMySession(String correlationId, User user, String userSessionId) throws ServiceException;
35
36 UserSession terminateMySession(String correlationId, User user, String userSessionId) throws ServiceException;
37
38 UserSession getUserSession(String correlationId, User user, String userSessionId) throws ServiceException;
39
40 UserSession terminateUserSession(String correlationId, User user, String userSessionId) throws ServiceException;
41 }