Implementing reCAPTCHA validation as part of the authentication service.#214
Implementing reCAPTCHA validation as part of the authentication service.#214vanitha1822 merged 3 commits intodevelopfrom
Conversation
WalkthroughCAPTCHA validation has been integrated into the user authentication flow. This includes adding new configuration properties for CAPTCHA integration, introducing a service for CAPTCHA validation, updating the login request model to include a CAPTCHA token, and modifying the authentication controller to validate the CAPTCHA token before proceeding with user authentication. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Controller as IEMRAdminController
participant CaptchaService as CaptchaValidationService
participant AuthService as Existing Auth Logic
User->>Controller: Submit LoginRequestModel (with captchaToken)
Controller->>CaptchaService: validateCaptcha(captchaToken)
CaptchaService->>CaptchaService: Validate token (HTTP POST to verify-url)
CaptchaService-->>Controller: true/false
alt CAPTCHA validation fails
Controller-->>User: Return error (CAPTCHA failed)
else CAPTCHA validation passes or skipped
Controller->>AuthService: Continue with password decryption and authentication
AuthService-->>Controller: Authentication result
Controller-->>User: Return authentication result
end
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (1)
src/main/java/com/iemr/common/controller/users/IEMRAdminController.java (1)
83-84: Consider aligning variable naming with class name.The variable name
captchaValidatorServicedoesn't match the class nameCaptchaValidationService. Consider renaming for consistency.@Autowired -private CaptchaValidationService captchaValidatorService; +private CaptchaValidationService captchaValidationService;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/environment/common_ci.properties(1 hunks)src/main/environment/common_example.properties(1 hunks)src/main/java/com/iemr/common/controller/users/IEMRAdminController.java(3 hunks)src/main/java/com/iemr/common/model/user/LoginRequestModel.java(1 hunks)src/main/java/com/iemr/common/service/recaptcha/CaptchaValidationService.java(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: style-check / checkstyle
- GitHub Check: Package-test
- GitHub Check: Analyze (java)
- GitHub Check: Build
🔇 Additional comments (4)
src/main/environment/common_ci.properties (1)
177-178: LGTM! Proper environment variable configuration.The captcha configuration properties are correctly implemented using environment variable placeholders, which is the appropriate approach for CI environments to keep sensitive values secure.
src/main/environment/common_example.properties (1)
201-203: LGTM! Clear example configuration provided.The captcha configuration examples are well-documented with clear placeholders and the correct Cloudflare Turnstile verification URL. The formatting with the trailing blank line is consistent with the file's style.
src/main/java/com/iemr/common/model/user/LoginRequestModel.java (1)
34-34: LGTM! Clean field addition for captcha support.The
captchaTokenfield is properly added and will integrate seamlessly with the existing Lombok-generated methods. The field placement and type are appropriate for captcha token handling.src/main/java/com/iemr/common/controller/users/IEMRAdminController.java (1)
58-58: LGTM: Clean import addition.The import statement is properly placed and follows Java conventions.
|



📋 Description
JIRA ID: [AMM-1247]
Please provide a summary of the change and the motivation behind it. Include relevant context and details.
✅ Type of Change
ℹ️ Additional Information
Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.
Summary by CodeRabbit