This project has retired. For details please refer to its Attic page.
SimpleUser xref
View Javadoc

1   package org.apache.archiva.redback.users.memory;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   * http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.archiva.redback.users.User;
23  
24  import java.io.Serializable;
25  import java.util.ArrayList;
26  import java.util.Date;
27  import java.util.List;
28  
29  /**
30   * A Simple User record.
31   *
32   * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
33   */
34  public class SimpleUser
35      implements User, Serializable
36  {
37      private String username;
38  
39      private String password;
40  
41      private String email;
42  
43      private String fullName;
44  
45      private String encodedPassword;
46  
47      private Date lastPasswordChange;
48  
49      private Date lastLoginDate;
50  
51      private int countFailedLoginAttempts = 0;
52  
53      private boolean locked = false;
54  
55      private boolean permanent = false;
56  
57      private boolean validated = false;
58  
59      private List<String> previousEncodedPasswords;
60  
61      private Date accountCreationDate;
62  
63      private boolean passwordChangeRequired;
64  
65      public SimpleUser()
66      {
67          // no op
68      }
69  
70      public void addPreviousEncodedPassword( String encodedPassword )
71      {
72          getPreviousEncodedPasswords().add( encodedPassword );
73      }
74  
75      public Date getAccountCreationDate()
76      {
77          return accountCreationDate;
78      }
79  
80      public int getCountFailedLoginAttempts()
81      {
82          return countFailedLoginAttempts;
83      }
84  
85      public String getEmail()
86      {
87          return email;
88      }
89  
90      public String getEncodedPassword()
91      {
92          return encodedPassword;
93      }
94  
95      public String getFullName()
96      {
97          return fullName;
98      }
99  
100     public Date getLastLoginDate()
101     {
102         return lastLoginDate;
103     }
104 
105     public Date getLastPasswordChange()
106     {
107         return lastPasswordChange;
108     }
109 
110     public String getPassword()
111     {
112         return password;
113     }
114 
115     public List<String> getPreviousEncodedPasswords()
116     {
117         if ( previousEncodedPasswords == null )
118         {
119             previousEncodedPasswords = new ArrayList<String>();
120         }
121         return previousEncodedPasswords;
122     }
123 
124     public String getUsername()
125     {
126         return username;
127     }
128 
129     public boolean isLocked()
130     {
131         return locked;
132     }
133 
134     public void setAccountCreationDate( Date accountCreationDate )
135     {
136         this.accountCreationDate = accountCreationDate;
137     }
138 
139     public void setCountFailedLoginAttempts( int countFailedLoginAttempts )
140     {
141         this.countFailedLoginAttempts = countFailedLoginAttempts;
142     }
143 
144     public void setEmail( String email )
145     {
146         this.email = email;
147     }
148 
149     public void setEncodedPassword( String encodedPassword )
150     {
151         this.encodedPassword = encodedPassword;
152     }
153 
154     public void setFullName( String fullName )
155     {
156         this.fullName = fullName;
157     }
158 
159     public void setLastLoginDate( Date lastLoginDate )
160     {
161         this.lastLoginDate = lastLoginDate;
162     }
163 
164     public void setLastPasswordChange( Date lastPasswordChange )
165     {
166         this.lastPasswordChange = lastPasswordChange;
167     }
168 
169     public void setLocked( boolean locked )
170     {
171         this.locked = locked;
172     }
173 
174     public void setPassword( String password )
175     {
176         this.password = password;
177     }
178 
179     public void setPreviousEncodedPasswords( List<String> previousEncodedPasswords )
180     {
181         this.previousEncodedPasswords = previousEncodedPasswords;
182     }
183 
184     public void setUsername( String username )
185     {
186         this.username = username;
187     }
188 
189     public boolean isPasswordChangeRequired()
190     {
191         return passwordChangeRequired;
192     }
193 
194     public void setPasswordChangeRequired( boolean passwordChangeRequired )
195     {
196         this.passwordChangeRequired = passwordChangeRequired;
197     }
198 
199     public boolean isPermanent()
200     {
201         return permanent;
202     }
203 
204     public void setPermanent( boolean permanent )
205     {
206         this.permanent = permanent;
207     }
208 
209     public boolean isValidated()
210     {
211         return validated;
212     }
213 
214     public void setValidated( boolean validated )
215     {
216         this.validated = validated;
217     }
218 
219     public String getUserManagerId()
220     {
221         return "simple";
222     }
223 }