View difference between Paste ID: 81vqVLNz and KdJ5dqed
SHOW: | | - or go back to the newest paste.
1
package org.dropwizard.auth.core;
2
3
import java.security.Principal;
4
5
public class User implements Principal {
6
7
    private long id;
8
    private String userName;
9
    
10
    public User(String userName) {
11
        this.id = 0L;
12
        this.userName = userName;
13
    }
14
15
    public User(
16
            long id,
17
            String userName
18
    ) {
19
        this.id = id;
20
        this.userName = userName;
21
    }
22
23
    public long getId() {
24
        return id;
25
    }
26
27
    public void setId(long id) {
28
        this.id = id;
29
    }
30
31
    public String getUserName() {
32
        return userName;
33
    }
34
35
    public void setUserName(String userName) {
36
        this.userName = userName;
37
    }
38
39
    public boolean equals(User otherUser) {
40
        return (this.id == otherUser.id &&
41
                this.userName.equals(otherUser.userName));
42
    }
43
44
    public String toString() {
45
        return String.format(
46
                "User:{id:%d, userName: %s, password: %s}",
47
                this.id,
48
                this.userName);
49
    }
50
51
    public String getName() {
52
        return userName;
53
    }
54
}