-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.java
47 lines (42 loc) · 1.22 KB
/
User.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package ca.rasul.models;
import javax.security.auth.Subject;
import java.security.Principal;
/**
* @author Nasir Rasul {@literal nasir@rasul.ca}
*/
public class User implements Principal {
private final String username;
private final String password;
public User(final String username, final String password) {
this.username = username;
this.password = password;
}
/**
* Returns the name of this principal.
*
* @return the name of this principal.
*/
@Override
public String getName() {
return username;
}
/**
* Returns true if the specified subject is implied by this principal.
* <p>
* <p>The default implementation of this method returns true if
* {@code subject} is non-null and contains at least one principal that
* is equal to this principal.
* <p>
* <p>Subclasses may override this with a different implementation, if
* necessary.
*
* @param subject the {@code Subject}
* @return true if {@code subject} is non-null and is
* implied by this principal, or false otherwise.
* @since 1.8
*/
@Override
public boolean implies(final Subject subject) {
return true;
}
}