Skip to content

Commit ca0a15f

Browse files
committed
Minor JavaDocs Updates
CircleCI integration Signed-off-by: Joshua Gager <jlgager@jgcomptech.com>
1 parent ebf9649 commit ca0a15f

File tree

6 files changed

+71
-20
lines changed

6 files changed

+71
-20
lines changed

.circleci/config.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Java Maven CircleCI 2.0 configuration file
2+
#
3+
# Check https://circleci.com/docs/2.0/language-java/ for more details
4+
#
5+
version: 2
6+
jobs:
7+
build:
8+
docker:
9+
# specify the version you desire here
10+
- image: circleci/openjdk:10-jdk
11+
12+
# Specify service dependencies here if necessary
13+
# CircleCI maintains a library of pre-built images
14+
# documented at https://circleci.com/docs/2.0/circleci-images/
15+
# - image: circleci/postgres:9.4
16+
17+
working_directory: ~/repo
18+
19+
environment:
20+
# Customize the JVM maximum heap limit
21+
MAVEN_OPTS: -Xmx3200m
22+
23+
steps:
24+
- checkout
25+
26+
# Download and cache dependencies
27+
- restore_cache:
28+
keys:
29+
- v1-dependencies-{{ checksum "pom.xml" }}
30+
# fallback to using the latest cache if no exact match is found
31+
- v1-dependencies-
32+
33+
- run: mvn dependency:go-offline
34+
35+
- save_cache:
36+
paths:
37+
- ~/.m2
38+
key: v1-dependencies-{{ checksum "pom.xml" }}
39+
40+
# run tests!
41+
- run: mvn integration-test
42+

src/main/java/com/jgcomptech/tools/authc/AuthManager.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
import java.util.HashSet;
1616
import java.util.Map;
1717

18+
//TODO Create resetInstance() method to allow a new instance to be initialized.
19+
1820
/**
1921
* Manages all tasks related to a user account including sessions and user roles.
2022
* @since 1.5.0
@@ -84,7 +86,7 @@ public static AuthManager getNewInstance(final Database db, final String appIcon
8486

8587
//region User Manager Methods
8688
/**
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.
8890
* @param username the username to add
8991
* @param password the password for the new user
9092
* @param userRole the system user role for the new user
@@ -101,7 +103,7 @@ public boolean createUser(final String username,
101103
}
102104

103105
/**
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.
105107
* @param username the username to add
106108
* @param password the password for the new user
107109
* @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) {
169171
* @throws TableNotFoundException if users table is missing
170172
* @throws UserManagerException if an error occurs during lookup
171173
*/
174+
//TODO create UserManager implementation to reduce database activity
172175
public boolean isUserLocked(final String username) { return getUser(username).isLocked(); }
173176

174177
/**
@@ -212,6 +215,7 @@ private boolean setLocked(final String username, final boolean status) {
212215
* @throws TableNotFoundException if users table is missing
213216
* @throws UserManagerException if an error occurs during lookup
214217
*/
218+
//TODO create UserManager implementation to reduce database activity
215219
public boolean isPasswordExpired(final String username) { return getUser(username).isPasswordExpired(); }
216220

217221
/**
@@ -222,6 +226,7 @@ private boolean setLocked(final String username, final boolean status) {
222226
* @throws TableNotFoundException if users table is missing
223227
* @throws UserManagerException if an error occurs during lookup
224228
*/
229+
//TODO create UserManager implementation to reduce database activity
225230
public boolean isPasswordSetToExpire(final String username) { return getUser(username).hasPasswordExpiration(); }
226231

227232
/**
@@ -232,6 +237,7 @@ private boolean setLocked(final String username, final boolean status) {
232237
* @throws TableNotFoundException if users table is missing
233238
* @throws UserManagerException if an error occurs during lookup
234239
*/
240+
//TODO create UserManager implementation to reduce database activity
235241
public LocalDateTime getPasswordExpirationDate(final String username) {
236242
return getUser(username).getPasswordExpirationDate();
237243
}
@@ -245,6 +251,7 @@ public LocalDateTime getPasswordExpirationDate(final String username) {
245251
* @throws TableNotFoundException if users table is missing
246252
* @throws UserManagerException if an error occurs during lookup
247253
*/
254+
//TODO create UserManager implementation to reduce database activity
248255
public String getPasswordExpirationDate(final String username, final String format) {
249256
if(format == null || format.trim().isEmpty()) {
250257
throw new IllegalArgumentException("Format Cannot Be Null Or Empty!");
@@ -304,7 +311,7 @@ public boolean disablePasswordExpiration(final String username) {
304311
* @return true if no errors occurred
305312
* @throws IllegalArgumentException if values are null or empty
306313
* @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
308315
*/
309316
public boolean setUserRole(final String username,
310317
final UserRoleManager.SystemUserRoles userRole) {
@@ -318,14 +325,14 @@ public boolean setUserRole(final String username,
318325
* @return true if no errors occurred
319326
* @throws IllegalArgumentException if values are null or empty
320327
* @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
322329
*/
323330
public boolean setUserRole(final String username, final String userRole) {
324331
return userManager.setUserRole(username, userRole);
325332
}
326333

327334
/**
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.
329336
* @param username the username to change
330337
* @param password the new password
331338
* @return true if password is changed successfully
@@ -361,8 +368,8 @@ public boolean checkPasswordMatches(final String username, final String password
361368
public HashSet<UserAccount> getUsersList() { return userManager.getUsersList(); }
362369

363370
/**
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
366373
* @throws TableNotFoundException if users table is missing
367374
*/
368375
public HashSet<String> getUsernameList() { return userManager.getUsernameList(); }

src/main/java/com/jgcomptech/tools/authc/SessionManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,7 @@ public boolean loginUser(final String username)
657657
* @throws LockedAccountException if the user account is locked
658658
* @since 1.5.0
659659
*/
660+
//TODO create a method for multi-user context that accepts a UsernameLoginToken
660661
public boolean loginUser(final String username, final boolean multiSession)
661662
throws IllegalStateException, ExpiredCredentialsException, LockedAccountException {
662663
if(username == null || username.trim().isEmpty()) {

src/main/java/com/jgcomptech/tools/authc/Subject.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public Session getSession(final boolean multiSession) {
210210
public String getUsername() { return username; }
211211

212212
/**
213-
* Sets a new password for the user using SHA-512 password hashing.
213+
* Sets a new password for the user using BCrypt password hashing.
214214
* @param password the new password
215215
* @return true if password is changed successfully
216216
*/
@@ -224,7 +224,7 @@ public boolean setPassword(final String password) {
224224

225225
/**
226226
* Returns the user role of the currently assigned username.
227-
* @return the user type of the currently assigned username
227+
* @return the user role of the currently assigned username
228228
*/
229229
public UserRole getUserRole() {
230230
assertNotAnonymous();

src/main/java/com/jgcomptech/tools/authc/UserManager.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public UserManager(final Database db, final String appIconPath, final String pro
7171
try {
7272
if(!db.getInfo().tableExists(TABLE_NAME)) {
7373
//The password field is 150 chars in length due to the length of a SHA-512 hash
74+
//TODO check if 150 chars is too excessive since changing to BCrypt
7475
TypedStatement.newTable()
7576
.CREATE(TABLE_NAME, db)
7677
.addColumn(new ColumnBuilder(ID_FIELD, DataTypes.INTEGER).notNull().primaryKey().autoIncrement())
@@ -93,7 +94,7 @@ public UserManager(final Database db, final String appIconPath, final String pro
9394
}
9495

9596
/**
96-
* Creates a new user in the database using SHA-512 password hashing.
97+
* Creates a new user in the database using BCrypt password hashing.
9798
* @param username the username to add
9899
* @param password the password for the new user
99100
* @param userRole the system user role for the new user
@@ -119,7 +120,7 @@ public boolean createUser(final String username,
119120
}
120121

121122
/**
122-
* Creates a new user in the database using SHA-512 password hashing.
123+
* Creates a new user in the database using BCrypt password hashing.
123124
* @param username the username to add
124125
* @param password the password for the new user
125126
* @param userRole the name of the user role for the new user
@@ -248,9 +249,9 @@ public boolean userExists(final String username) {
248249
}
249250

250251
/**
251-
* Returns userType for the specified username.
252+
* Returns user role for the specified username.
252253
* @param username the username to lookup
253-
* @return the userType
254+
* @return the user role
254255
* @throws IllegalArgumentException if username is null or empty or if username does not exist
255256
* @throws TableNotFoundException if users table is missing
256257
* @throws UserManagerException if error occurs during lookup
@@ -278,13 +279,13 @@ public UserRole getUserRole(final String username) {
278279
}
279280

280281
/**
281-
* Sets the user type of the specified user.
282+
* Sets the user role of the specified user.
282283
* @param username the username of the user to update
283284
* @param userRole the system user role to change to
284285
* @return true if no errors occurred
285286
* @throws IllegalArgumentException if values are null or empty
286287
* @throws TableNotFoundException if users table is missing
287-
* @throws UserManagerException if an error occurs while changing user type
288+
* @throws UserManagerException if an error occurs while changing user role
288289
*/
289290
public boolean setUserRole(final String username,
290291
final UserRoleManager.SystemUserRoles userRole) {
@@ -298,13 +299,13 @@ public boolean setUserRole(final String username,
298299
}
299300

300301
/**
301-
* Sets the user type of the specified user.
302+
* Sets the user role of the specified user.
302303
* @param username the username of the user to update
303304
* @param userRole the name of the user role to change to
304305
* @return true if no errors occurred
305306
* @throws IllegalArgumentException if values are null or empty
306307
* @throws TableNotFoundException if users table is missing
307-
* @throws UserManagerException if an error occurs while changing user type
308+
* @throws UserManagerException if an error occurs while changing user role
308309
*/
309310
public boolean setUserRole(final String username, final String userRole) {
310311
if(username == null || username.trim().isEmpty()) {
@@ -327,7 +328,7 @@ public boolean setUserRole(final String username, final String userRole) {
327328
}
328329

329330
/**
330-
* Sets a new password for an existing user using SHA-512 password hashing.
331+
* Sets a new password for an existing user using BCrypt password hashing.
331332
* @param username the username to change
332333
* @param password the new password
333334
* @return true if password is changed successfully

src/main/java/com/jgcomptech/tools/authz/PermissionManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,13 +439,13 @@ public void loadPermissions(final boolean enableAll) {
439439
}
440440

441441
/**
442-
* Sets the correct permissions according to the specified user type.
442+
* Sets the correct permissions according to the specified user role.
443443
* @param userRole the user role to use to set permissions
444444
*/
445445
public void loadPermissions(final UserRoleManager.SystemUserRoles userRole) { loadPermissions(userRole.getRole()); }
446446

447447
/**
448-
* Sets the correct permissions according to the specified user type.
448+
* Sets the correct permissions according to the specified user role.
449449
* @param userRole the user role to use to set permissions
450450
* @since 1.5.0 now uses a parallel stream allowing a large list of permissions
451451
*/

0 commit comments

Comments
 (0)