Implement recovery key support for user storage providers - #2
Open
ShashankFC wants to merge 1 commit into
Open
Conversation
closes #38445 Signed-off-by: rtufisi <rtufisi@phasetwo.io>
There was a problem hiding this comment.
Pull request overview
This PR implements recovery key support for user storage providers, extending backwards compatibility to allow legacy storage systems to handle recovery codes alongside existing authentication methods.
Changes:
- Added recovery codes as a supported credential type in backwards-compatible user storage implementations
- Implemented recovery code validation and verification logic within the authentication flow
- Introduced utility methods to retrieve recovery code credentials from both federated and local storage
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| BackwardsCompatibilityUserStorageTest.java | Added comprehensive test for recovery key setup and authentication flow |
| BackwardsCompatibilityUserStorageFactory.java | Added method to check if user has recovery codes |
| BackwardsCompatibilityUserStorage.java | Implemented recovery codes credential storage, validation, and retrieval |
| RecoveryAuthnCodeInputLoginBean.java | Updated to use utility method for retrieving recovery code credentials |
| RecoveryAuthnCodesAction.java | Refactored to use helper method for credential creation |
| RecoveryAuthnCodesFormAuthenticator.java | Updated to use utility method for retrieving recovery code credentials |
| RecoveryAuthnCodesUtils.java | Added utility method to retrieve credentials from federated or local storage |
| CredentialHelper.java | Added helper method to create recovery codes in user storage or local storage |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .addSubFlowExecution("Recovery-Authn-Codes subflow", AuthenticationFlow.BASIC_FLOW, AuthenticationExecutionModel.Requirement.ALTERNATIVE, altSubFlow -> altSubFlow | ||
| .addAuthenticatorExecution(AuthenticationExecutionModel.Requirement.REQUIRED, RecoveryAuthnCodesFormAuthenticatorFactory.PROVIDER_ID) | ||
| .addAuthenticatorExecution(AuthenticationExecutionModel.Requirement.REQUIRED, "delayed-authenticator", config -> { | ||
| config.setAlias("delayed-suthenticator-config"); |
There was a problem hiding this comment.
Corrected spelling of 'suthenticator' to 'authenticator'.
Suggested change
| config.setAlias("delayed-suthenticator-config"); | |
| config.setAlias("delayed-authenticator-config"); |
| ); | ||
| credentialModels.add(model); | ||
| } catch (IOException e) { | ||
| log.error("Could not deserialize credential of type: recovery-codes"); |
There was a problem hiding this comment.
Extra space found between 'deserialize' and 'credential'.
Suggested change
| log.error("Could not deserialize credential of type: recovery-codes"); | |
| log.error("Could not deserialize credential of type: recovery-codes"); |
| * Checks the user storage for the credential. If not found it will look for the credential in the local storage | ||
| * | ||
| * @param user - User model | ||
| * @return - a optional credential model |
There was a problem hiding this comment.
Extra space found between 'optional' and 'credential'.
Suggested change
| * @return - a optional credential model | |
| * @return - a optional credential model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test 9
Summary by CodeRabbit
New Features
✏️ Tip: You can customize this high-level summary in your review settings.
Replicated from ai-code-review-evaluation/keycloak-coderabbit#9