feat :Add partial support for PAR auth flow#967
Conversation
|
|
||
| import android.content.Context | ||
| import android.net.Uri | ||
| import android.util.Log |
There was a problem hiding this comment.
Uri and Log can be removed not used.
| private var requestCode = 0 | ||
|
|
||
| private companion object { | ||
| private val TAG = "PARCodeManager" |
There was a problem hiding this comment.
TAG can be removed not used.
| @@ -0,0 +1,65 @@ | |||
| package com.auth0.android.provider | |||
There was a problem hiding this comment.
This manager doesn't survive Activity recreation. If the user rotates the device while the browser is open, managerInstance is lost and the callback silently fails.
OAuthManager handles this via toState() / onRestoreInstanceState(). PARCodeManager has no equivalent.
| AuthenticationActivity.authenticateUsingBrowser(context, uri, false, ctOptions) | ||
| } | ||
|
|
||
| override fun resume(result: AuthorizeResult): Boolean { |
There was a problem hiding this comment.
There's no state validation here. The existing OAuth flow generates a state and validates it on callback.
The PAR flow passes state through in the result but never checks it.
There was a problem hiding this comment.
SDK doesn't know the value of the state to validate against. The state and code_verifier is handled by the consuming application via the BFF approach. The SDK in this case just authorize the user and returns the code and state back to the user.
There was a problem hiding this comment.
One thing we can do in this case is take an input state value from the user and compare that against the returned state
| ) | ||
|
|
||
| managerInstance = manager | ||
| manager.startAuthentication(context, 110) |
There was a problem hiding this comment.
private const val AUTH_REQUEST_CODE = 110
also used in line 607
Changes
adds support for Pushed Authorization Request (PAR) flows where the backend-for-frontend (BFF) handles the /par and /token endpoints while the SDK manages the browser-based authorization.
####Usage
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