15
15
import java .util .HashSet ;
16
16
import java .util .Map ;
17
17
18
+ //TODO Create resetInstance() method to allow a new instance to be initialized.
19
+
18
20
/**
19
21
* Manages all tasks related to a user account including sessions and user roles.
20
22
* @since 1.5.0
@@ -84,7 +86,7 @@ public static AuthManager getNewInstance(final Database db, final String appIcon
84
86
85
87
//region User Manager Methods
86
88
/**
87
- * Creates a new user in the database using SHA-512 password hashing.
89
+ * Creates a new user in the database using BCrypt password hashing.
88
90
* @param username the username to add
89
91
* @param password the password for the new user
90
92
* @param userRole the system user role for the new user
@@ -101,7 +103,7 @@ public boolean createUser(final String username,
101
103
}
102
104
103
105
/**
104
- * Creates a new user in the database using SHA-512 password hashing.
106
+ * Creates a new user in the database using BCrypt password hashing.
105
107
* @param username the username to add
106
108
* @param password the password for the new user
107
109
* @param userRole the name of the user role for the new user
@@ -169,6 +171,7 @@ public String getUserCreationDate(final String username, final String format) {
169
171
* @throws TableNotFoundException if users table is missing
170
172
* @throws UserManagerException if an error occurs during lookup
171
173
*/
174
+ //TODO create UserManager implementation to reduce database activity
172
175
public boolean isUserLocked (final String username ) { return getUser (username ).isLocked (); }
173
176
174
177
/**
@@ -212,6 +215,7 @@ private boolean setLocked(final String username, final boolean status) {
212
215
* @throws TableNotFoundException if users table is missing
213
216
* @throws UserManagerException if an error occurs during lookup
214
217
*/
218
+ //TODO create UserManager implementation to reduce database activity
215
219
public boolean isPasswordExpired (final String username ) { return getUser (username ).isPasswordExpired (); }
216
220
217
221
/**
@@ -222,6 +226,7 @@ private boolean setLocked(final String username, final boolean status) {
222
226
* @throws TableNotFoundException if users table is missing
223
227
* @throws UserManagerException if an error occurs during lookup
224
228
*/
229
+ //TODO create UserManager implementation to reduce database activity
225
230
public boolean isPasswordSetToExpire (final String username ) { return getUser (username ).hasPasswordExpiration (); }
226
231
227
232
/**
@@ -232,6 +237,7 @@ private boolean setLocked(final String username, final boolean status) {
232
237
* @throws TableNotFoundException if users table is missing
233
238
* @throws UserManagerException if an error occurs during lookup
234
239
*/
240
+ //TODO create UserManager implementation to reduce database activity
235
241
public LocalDateTime getPasswordExpirationDate (final String username ) {
236
242
return getUser (username ).getPasswordExpirationDate ();
237
243
}
@@ -245,6 +251,7 @@ public LocalDateTime getPasswordExpirationDate(final String username) {
245
251
* @throws TableNotFoundException if users table is missing
246
252
* @throws UserManagerException if an error occurs during lookup
247
253
*/
254
+ //TODO create UserManager implementation to reduce database activity
248
255
public String getPasswordExpirationDate (final String username , final String format ) {
249
256
if (format == null || format .trim ().isEmpty ()) {
250
257
throw new IllegalArgumentException ("Format Cannot Be Null Or Empty!" );
@@ -304,7 +311,7 @@ public boolean disablePasswordExpiration(final String username) {
304
311
* @return true if no errors occurred
305
312
* @throws IllegalArgumentException if values are null or empty
306
313
* @throws TableNotFoundException if users table is missing
307
- * @throws UserManagerException if an error occurs while changing user type
314
+ * @throws UserManagerException if an error occurs while changing user role
308
315
*/
309
316
public boolean setUserRole (final String username ,
310
317
final UserRoleManager .SystemUserRoles userRole ) {
@@ -318,14 +325,14 @@ public boolean setUserRole(final String username,
318
325
* @return true if no errors occurred
319
326
* @throws IllegalArgumentException if values are null or empty
320
327
* @throws TableNotFoundException if users table is missing
321
- * @throws UserManagerException if an error occurs while changing user type
328
+ * @throws UserManagerException if an error occurs while changing user role
322
329
*/
323
330
public boolean setUserRole (final String username , final String userRole ) {
324
331
return userManager .setUserRole (username , userRole );
325
332
}
326
333
327
334
/**
328
- * Sets a new password for an existing user using SHA-512 password hashing.
335
+ * Sets a new password for an existing user using BCrypt password hashing.
329
336
* @param username the username to change
330
337
* @param password the new password
331
338
* @return true if password is changed successfully
@@ -361,8 +368,8 @@ public boolean checkPasswordMatches(final String username, final String password
361
368
public HashSet <UserAccount > getUsersList () { return userManager .getUsersList (); }
362
369
363
370
/**
364
- * Returns a list of the user names in the database.
365
- * @return a list of the user names in the database
371
+ * Returns a list of the usernames in the database.
372
+ * @return a list of the usernames in the database
366
373
* @throws TableNotFoundException if users table is missing
367
374
*/
368
375
public HashSet <String > getUsernameList () { return userManager .getUsernameList (); }
0 commit comments