View Javadoc
1   package au.gov.amsa.ais.router.model;
2   
3   public final class User {
4   
5       private final String username;
6       private final String passwordHash;
7       private final String passwordSalt;
8   
9       private User(String username, String passwordHash, String passwordSalt) {
10          Util.verifyNotBlank("username", username);
11          Util.verifyNotBlank("passwordHash", passwordHash);
12          Util.verifyNotBlank("passwordSalt", passwordSalt);
13          this.username = username;
14          this.passwordHash = passwordHash;
15          this.passwordSalt = passwordSalt;
16      }
17  
18      public String getUsername() {
19          return username;
20      }
21  
22      public String getPasswordHash() {
23          return passwordHash;
24      }
25  
26      public String getPasswordSalt() {
27          return passwordSalt;
28      }
29  
30      public static Builder builder() {
31          return new Builder();
32      }
33  
34      public static class Builder {
35  
36          private String username;
37          private String passwordHash;
38          private String passwordSalt;
39  
40          private Builder() {
41          }
42  
43          public Builder username(String username) {
44              this.username = username;
45              return this;
46          }
47  
48          public Builder passwordHash(String passwordHash) {
49              this.passwordHash = passwordHash;
50              return this;
51          }
52  
53          public Builder passwordSalt(String passwordSalt) {
54              this.passwordSalt = passwordSalt;
55              return this;
56          }
57  
58          public User build() {
59              return new User(username, passwordHash, passwordSalt);
60          }
61      }
62  }