Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DUNA flow: Resume Auth , Fixes AB#3079802 #2557

Open
wants to merge 87 commits into
base: dev
Choose a base branch
from

Conversation

p3dr0rv
Copy link
Contributor

@p3dr0rv p3dr0rv commented Dec 11, 2024

This PR addresses step 16 of the Switch browser flow

  • BrokerBrowserRedirectActivity will re-start the WebViewAuthorizationFragment so we update the intent data and handle the activity being resumed on WebViewAuthorizationFragment.onResume

  • The switch browser resume endpoint requires the client ID, so we need to pass this value at the moment we start the WebAuthorizaFragment.

  • Refactor AuthorizationActivityFactory to work with one data parameter to create the auth intent.

AB#3079802

Copy link

❌ Work item link check failed. Description does not contain AB#{ID}.

Click here to Learn more.

@p3dr0rv p3dr0rv changed the title [WIP] Back to WebView DUNA flow: Resume Auth Dec 12, 2024
@p3dr0rv p3dr0rv marked this pull request as ready for review December 12, 2024 18:57
@p3dr0rv p3dr0rv requested a review from a team as a code owner December 12, 2024 18:57
Copy link

✅ Work item link check complete. Description contains link AB#3079802 to an Azure Boards work item.

Copy link

❌ Work item link check failed. Description contains AB#3079802
but the Bot could not link it to an Azure Boards work item.

Click here to learn more.

@github-actions github-actions bot changed the title DUNA flow: Resume Auth DUNA flow: Resume Auth , Fixes AB#3079802 Feb 23, 2025
@p3dr0rv p3dr0rv marked this pull request as ready for review February 23, 2025 22:52
*/
private boolean isSwitchBrowserResumeFlow(@NonNull final Bundle extras) {
final String methodTag = TAG + ":isSwitchBrowserResumeFlow";
final boolean containsActionUri = extras.containsKey(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we also checking the path to validate?

redirect_uri/switch_browser_resume

I think we should validate that.

If action_uri and code are missing while in a switch browser flow then that should be considered a bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we are validating the path on the BrokerBrowserRedirectActivity, reworked, so here if action_uri and code are missing and is a resume flow we consider it an error

if (actionUri == null || code == null) {
Logger.error(methodTag, "Action URI is null: " + (actionUri == null) +
", code is null: " + (code == null), null);
cancelAuthorization(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this error surfaced back to client? Does this come back as User cancel?

We need to send this back as cancel with some error information about the required fields being missing and also need to report this in telemetry

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworked and call sendResult directly to surface the exception to the client.
regarding telemetry I will have my final PR with the telemetry :)

@@ -120,6 +126,8 @@ public class WebViewAuthorizationFragment extends AuthorizationFragment {

// This is used by LegacyFido2ApiManager to launch a PendingIntent received by the legacy API.
private ActivityResultLauncher<LegacyFido2ApiObject> mFidoLauncher;
// This flag is used to determine if the fragment is waiting for the switch browser resume endpoint.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem like a flag. This is really an object

return null;
}
);
} catch (ClientException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} catch (ClientException e) {
} catch (final ClientException e) {

* It contains the URI to be opened in the new browser.
*/
data class SwitchBrowserChallenge(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kinda liked this name more

}

fun unbind() {
/**
* Check if the request is to start the switch the browser flow.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Check if the request is to start the switch the browser flow.
* Check if the request is to start the switch browser flow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants