-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImpAuthService.java
30 lines (25 loc) · 1006 Bytes
/
ImpAuthService.java
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
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.HashMap;
import java.util.Map;
public class ImpAuthService extends UnicastRemoteObject implements AuthService {
private Map<String, String> adminCredentials;
private Map<String, String> clientCredentials;
protected ImpAuthService() throws RemoteException {
super();
adminCredentials = new HashMap<>();
clientCredentials = new HashMap<>();
adminCredentials.put("admin", "admin");
clientCredentials.put("client", "client");
}
@Override
public boolean Authothification(String username, String password) throws RemoteException {
if (adminCredentials.containsKey(username)) {
return adminCredentials.get(username).equals(password);
} else if (clientCredentials.containsKey(username)) {
return clientCredentials.get(username).equals(password);
} else {
return false;
}
}
}