-
Notifications
You must be signed in to change notification settings - Fork 36
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
Switch to browser on DUNA redirect URL., Fixes AB#3079799 #2553
base: dev
Are you sure you want to change the base?
Conversation
❌ Work item link check failed. Description does not contain AB#{ID}. Click here to Learn more. |
✅ Work item link check complete. Description contains link AB#3079799 to an Azure Boards work item. |
common/src/main/java/com/microsoft/identity/common/adal/internal/AuthenticationConstants.java
Outdated
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/adal/internal/AuthenticationConstants.java
Outdated
Show resolved
Hide resolved
…D/microsoft-authentication-library-common-for-android into pedroro/switch-to-browser
common/src/main/java/com/microsoft/identity/common/adal/internal/AuthenticationConstants.java
Outdated
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/internal/broker/BrokerRequest.java
Outdated
Show resolved
Hide resolved
...n/src/main/java/com/microsoft/identity/common/internal/request/MsalBrokerRequestAdapter.java
Outdated
Show resolved
Hide resolved
...ava/com/microsoft/identity/common/internal/ui/webview/AzureActiveDirectoryWebViewClient.java
Outdated
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/adal/internal/AuthenticationConstants.java
Outdated
Show resolved
Hide resolved
...va/com/microsoft/identity/common/internal/providers/oauth2/AuthorizationActivityFactory.java
Outdated
Show resolved
Hide resolved
...om/microsoft/identity/common/internal/ui/webview/challengehandlers/SwitchBrowserUriHelper.kt
Outdated
Show resolved
Hide resolved
...om/microsoft/identity/common/internal/ui/webview/challengehandlers/SwitchBrowserUriHelper.kt
Outdated
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/adal/internal/AuthenticationConstants.java
Outdated
Show resolved
Hide resolved
...ava/com/microsoft/identity/common/internal/ui/webview/AzureActiveDirectoryWebViewClient.java
Outdated
Show resolved
Hide resolved
...om/microsoft/identity/common/internal/ui/webview/challengehandlers/SwitchBrowserChallenge.kt
Outdated
Show resolved
Hide resolved
...om/microsoft/identity/common/internal/ui/webview/challengehandlers/SwitchBrowserUriHelper.kt
Outdated
Show resolved
Hide resolved
...om/microsoft/identity/common/internal/ui/webview/challengehandlers/SwitchBrowserUriHelper.kt
Outdated
Show resolved
Hide resolved
…al/AuthenticationConstants.java Co-authored-by: Shahzaib <[email protected]>
...om/microsoft/identity/common/internal/ui/webview/challengehandlers/SwitchBrowserUriHelper.kt
Outdated
Show resolved
Hide resolved
...ava/com/microsoft/identity/common/internal/ui/webview/AzureActiveDirectoryWebViewClient.java
Outdated
Show resolved
Hide resolved
…/webview/AzureActiveDirectoryWebViewClient.java Co-authored-by: Shahzaib <[email protected]>
…D/microsoft-authentication-library-common-for-android into pedroro/switch-to-browser
if (throwable instanceof IErrorInformation) { | ||
errorCode = ((IErrorInformation) throwable).getErrorCode(); | ||
} else { | ||
errorCode = MALFORMED_URL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we ever get here then is it guaranteed to always be a case of malformed url? We are catching generic throwable so I'm not sure if that's always the case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changing error code
BrowserDescriptor.getBrowserSafeListForSwitchBrowser(), | ||
null | ||
) | ||
if (browser == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a case of browser being uninstalled between the time interactive request started and got to this point? I'm asking because I see we already check for browser being available even before we declare switch browser capable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, at this point we expect the browser not to be null as we check prior to initiate DUNA, but because the function can return null, we do this check
...om/microsoft/identity/common/internal/ui/webview/challengehandlers/SwitchBrowserUriHelper.kt
Outdated
Show resolved
Hide resolved
val exception = Assert.assertThrows(ClientException::class.java) { | ||
SwitchBrowserUriHelper.buildProcessUri(redirectUri) | ||
} | ||
Assert.assertEquals(ClientException.MALFORMED_URL, exception.errorCode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also assert the error message
…/webview/challengehandlers/SwitchBrowserUriHelper.kt Co-authored-by: Shahzaib <[email protected]>
In this PR we made the necessary changes to allow the transition from WebView to Browser when a DUNA redirect URL is present. Steps 8 and 9: DUNA flow
At this point ESTS on the WebView will invoke a broker redirect url (msauth://Microsoft.AAD.BrokerPlugin?code=switchBrowserSessionToken&action=switch_browser&action_uri=login.microsoftonline.com/switchbrowser/process)
that will trigger AzureActiveDirectoryWebViewClient to handle the DUNA redirect URL and launch the browser to the switchbrowser/process endpoint
How it works:
If chrome or edge is installed and the SwitchToBrowser client is enabled, then we can declare ourselves DUNA capable. see: broker related PR
If ESTS calls a broker redirect URL for DUNA AzureActiveDirectoryWebViewClient will handle the DUNA redirect URL and use EmbeddedWebViewAuthorizationStrategy to launch the browser to the switchbrowser/process endpoint. (this PR)
Main Changes:
AB#3079799