diff --git a/src/main/java/com/digitalsanctuary/spring/user/controller/UserActionController.java b/src/main/java/com/digitalsanctuary/spring/user/controller/UserActionController.java index 73d2b13..631699e 100644 --- a/src/main/java/com/digitalsanctuary/spring/user/controller/UserActionController.java +++ b/src/main/java/com/digitalsanctuary/spring/user/controller/UserActionController.java @@ -89,13 +89,13 @@ public ModelAndView showChangePasswordPage(final HttpServletRequest request, fin } /** - * Validate a forgot password token link from an email, and if valid, show the - * registration success page. + * Validates a registration token received from an email link, and if valid, + * confirms the user's registration and redirects to the registration success page. * - * @param request the request - * @param model the model - * @param token the token - * @return the model and view + * @param request the HTTP request + * @param model the model map + * @param token the verification token to validate + * @return the model and view for redirection * @throws UnsupportedEncodingException the unsupported encoding exception */ @GetMapping("${user.security.registrationConfirmURI:/user/registrationConfirm}") diff --git a/src/main/java/com/digitalsanctuary/spring/user/service/UserService.java b/src/main/java/com/digitalsanctuary/spring/user/service/UserService.java index 210b909..4d86db1 100644 --- a/src/main/java/com/digitalsanctuary/spring/user/service/UserService.java +++ b/src/main/java/com/digitalsanctuary/spring/user/service/UserService.java @@ -34,17 +34,12 @@ import lombok.extern.slf4j.Slf4j; /** - * Service class for managing users. It includes methods for user authentication, registration, deletion, password management, role assignment, and - * related operations. This class also interacts with the user repository and session registry to perform its tasks. + * Service class for managing users. Provides methods for user registration, authentication, password management, and user-related operations. This + * class is transactional and uses various repositories and services for its operations. * *
* This class is transactional, meaning that any failure causes the entire operation to roll back to the previous state. - * - * @author Devon Hillard - */ -/** - * Service class for managing users. Provides methods for user registration, authentication, password management, and user-related operations. This - * class is transactional and uses various repositories and services for its operations. + *
* ** Dependencies: @@ -112,6 +107,8 @@ *
SECURITY WARNING: This is a potentially dangerous method as it authenticates + * a user without password verification. This method should only be used in specific controlled scenarios, + * such as after successful email verification or OAuth authentication.
* - * @param user The user to authenticate. + * @param user The user to authenticate without password verification */ public void authWithoutPassword(User user) { log.debug("UserService.authWithoutPassword: authenticating user: {}", user); diff --git a/src/main/java/com/digitalsanctuary/spring/user/service/UserVerificationService.java b/src/main/java/com/digitalsanctuary/spring/user/service/UserVerificationService.java index 5874e83..7077375 100644 --- a/src/main/java/com/digitalsanctuary/spring/user/service/UserVerificationService.java +++ b/src/main/java/com/digitalsanctuary/spring/user/service/UserVerificationService.java @@ -43,20 +43,21 @@ public User getUserByVerificationToken(final String verificationToken) { } /** - * Gets the verification token. + * Gets the verification token by its string value. * - * @param VerificationToken the verification token - * @return the verification token + * @param verificationToken the verification token string + * @return the verification token entity */ - public VerificationToken getVerificationToken(final String VerificationToken) { - return tokenRepository.findByToken(VerificationToken); + public VerificationToken getVerificationToken(final String verificationToken) { + return tokenRepository.findByToken(verificationToken); } /** - * Generate new verification token. + * Generates a new verification token to replace an existing one. + * Useful for extending verification periods or re-sending verification emails. * - * @param existingVerificationToken the existing verification token - * @return the verification token + * @param existingVerificationToken the existing verification token string to replace + * @return the updated verification token entity with a new token value */ public VerificationToken generateNewVerificationToken(final String existingVerificationToken) { VerificationToken vToken = tokenRepository.findByToken(existingVerificationToken); @@ -77,10 +78,10 @@ public void createVerificationTokenForUser(final User user, final String token) } /** - * Validate verification token. + * Validates a user verification token. * - * @param token the token - * @return the string + * @param token the token to validate + * @return the token validation result (VALID, INVALID_TOKEN, or EXPIRED) */ public UserService.TokenValidationResult validateVerificationToken(String token) { final VerificationToken verificationToken = tokenRepository.findByToken(token);