1 : |
dgarcia |
1 |
package eu.smartlm.abs.portal.security.login.service;
|
2 : |
|
|
|
3 : |
|
|
import java.util.List;
|
4 : |
|
|
|
5 : |
|
|
import eu.smartlm.abs.portal.security.login.model.User;
|
6 : |
|
|
|
7 : |
|
|
/**
|
8 : |
|
|
* Specifies the basic interface that should complain any implementation of the login procedure
|
9 : |
|
|
* @author David García Pérez - CESGA
|
10 : |
|
|
*/
|
11 : |
|
|
public interface LoginService {
|
12 : |
|
|
public int USER_SUCCESSFULLY_ADDED = 100;
|
13 : |
|
|
public int USER_ALREADY_EXISTS = 200;
|
14 : |
|
|
public int WRONG_USERNAME = 300;
|
15 : |
|
|
public int WRONG_PASSWORD = 400;
|
16 : |
|
|
public int USER_SUCCESSFULLY_EDITED = 500;
|
17 : |
|
|
|
18 : |
|
|
/**
|
19 : |
|
|
* If the user has valid credentials it gives back a <code>true</code> value
|
20 : |
|
|
* @param user User credentials
|
21 : |
|
|
* @return <code>true</code> if the User credentials are valid, <code>false</code> otherwise
|
22 : |
|
|
*/
|
23 : |
|
|
public boolean isValidLogin(User user);
|
24 : |
|
|
|
25 : |
|
|
/**
|
26 : |
|
|
* Gets a list of all users that can log in into the server
|
27 : |
|
|
* @return a list of all users
|
28 : |
|
|
*/
|
29 : |
|
|
public List<User> getUsers();
|
30 : |
|
|
|
31 : |
|
|
/**
|
32 : |
|
|
* Adds a user to the database
|
33 : |
|
|
* @param user user to be added
|
34 : |
|
|
* @return code if a user was successfully added or the error message
|
35 : |
|
|
*/
|
36 : |
|
|
public int addUser(User user);
|
37 : |
|
|
|
38 : |
|
|
/**
|
39 : |
|
|
* Gets user by username
|
40 : |
|
|
* @param username
|
41 : |
|
|
* @return
|
42 : |
|
|
*/
|
43 : |
|
|
public User getUser(String username);
|
44 : |
|
|
|
45 : |
|
|
/**
|
46 : |
|
|
* Edits the data of an specific user
|
47 : |
|
|
* @param user username of the user to be edit
|
48 : |
|
|
* @return code if a user was succesfully edited or the error message
|
49 : |
|
|
*/
|
50 : |
|
|
public int editUser(User user);
|
51 : |
|
|
|
52 : |
|
|
/**
|
53 : |
|
|
* Removew a user vi its username
|
54 : |
|
|
* @param username
|
55 : |
|
|
*/
|
56 : |
|
|
public void removeUser(String username);
|
57 : |
|
|
}
|