Exposes UserProfile to return contents of id token without refreshing credentials#840
Exposes UserProfile to return contents of id token without refreshing credentials#840NandanPrabhu merged 8 commits intomainfrom
Conversation
|
@NandanPrabhu The title claims to return Credentials but this returns only the UserProfile to the end user . Please update the tile accordingly as it can be misleading when generating the release notes |
| Executors.newSingleThreadExecutor() | ||
| ) | ||
|
|
||
| public override val userProfile: UserProfile? |
There was a problem hiding this comment.
The Credentials class already has an userProfile property which returns the decoded UserProfile . We can reuse that
There was a problem hiding this comment.
we can add a getExistingCredentials() method here similar to SecureCredentialsManager to construct the complete Credentials object. Since here usecase is to retrieve id token and returns its contents, we are retrieving only the ID token from storage @pmathew92
| } | ||
| } | ||
|
|
||
| private fun retrieveCredentials() : Credentials? { |
There was a problem hiding this comment.
No need for this as there is already a method getExistingCredentials which does the exact same thing
| return credentials | ||
| } | ||
|
|
||
| public override val userProfile: UserProfile? |
There was a problem hiding this comment.
Reuse userProfile property from Credentials class
| } | ||
|
|
||
| @Test | ||
| public fun shouldFailOnUserProfileWhenCredentialsIsNotSaved() { |
There was a problem hiding this comment.
since we are using existing function removed these test cases
Changes
This PR covers addressing a github issue requesting a feature to allow accessing credentials without refresh.
Both SecureCredentialsManager and CredentialManager returns credentials directly from storage. In case of SecureCredentialsManager, it takes care of fetching from storage and decrypting as well.
References
auth0/auth0-flutter#378
Testing
Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. Since this library has unit testing, tests should be added for new functionality and existing tests should complete without errors.
This change adds unit test coverage
This change adds integration test coverage
This change has been tested on the latest version of the platform/language or why not
Checklist
I have read the Auth0 general contribution guidelines
I have read the Auth0 Code of Conduct
All existing and new tests complete without errors