-
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
Organize browser selection classes and change signature for get AuthorizationStrategy, Fixes AB#3119409 #2564
Conversation
…/microsoft-authentication-library-common-for-android into pedroro/browser-selector
✅ Work item link check complete. Description contains link AB#3119409 to an Azure Boards work item. |
...main/java/com/microsoft/identity/common/internal/ui/AndroidAuthorizationStrategyFactory.java
Outdated
Show resolved
Hide resolved
.../java/com/microsoft/identity/common/internal/ui/CurrentTaskBrowserAuthorizationStrategy.java
Outdated
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/internal/ui/browser/BrowserSelector.java
Outdated
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/internal/ui/browser/BrowserSelector.java
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/internal/ui/browser/BrowserSelector.java
Outdated
Show resolved
Hide resolved
common/src/main/java/com/microsoft/identity/common/internal/ui/browser/BrowserSelector.java
Outdated
Show resolved
Hide resolved
if (parameters.getAuthorizationAgent() == AuthorizationAgent.WEBVIEW) { | ||
Logger.info(methodTag, "Use webView for authorization."); | ||
// Use embedded webView if no browser available or authorization agent is webView | ||
if (authorizationAgent == AuthorizationAgent.WEBVIEW || 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.
If someone passes authorization agent as BROWSER but passes null browser, then what strategy is picked?
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.
embedded web view authorization strategy
Add Javadoc:
- Get the authorization strategy based on the authorization agent and browser.
- If the authorization agent is WEBVIEW or the browser is null,
- return the embedded web view authorization strategy.
- Otherwise, return the browser authorization strategy.
@NonNull final AuthorizationAgent authorizationAgent, | ||
@Nullable final Browser browser, |
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 someone passes authorization agent as WEBVIEW but also a non-null browser then what does that mean? What strategy gets picked?
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.
embedded web view authorization strategy
Add Javadoc:
* Get the authorization strategy based on the authorization agent and browser.
* If the authorization agent is WEBVIEW or the browser is null,
* return the embedded web view authorization strategy.
* Otherwise, return the browser authorization strategy.
common4j/src/main/com/microsoft/identity/common/java/browser/IBrowserSelector.java
Outdated
Show resolved
Hide resolved
common4j/src/main/com/microsoft/identity/common/java/browser/NoopBrowserSelector.java
Show resolved
Hide resolved
common4j/src/main/com/microsoft/identity/common/java/ui/BrowserDescriptor.java
Outdated
Show resolved
Hide resolved
@shahzaibj, it seems there is some confusion about the getAuthorizationStrategy method. I’ve rephrased my comment and included it as Javadoc. Does that address the issue, or were you suggesting a different approach? |
common4j/src/main/com/microsoft/identity/common/java/interfaces/IPlatformComponents.java
Show resolved
Hide resolved
common4j/src/main/com/microsoft/identity/common/java/util/IPlatformUtil.java
Show resolved
Hide resolved
how about we set browserSelector on AndroidAuthorizationStrategyFactory here itself. with that you may avoid calling browselect every time before creating AndroidAuthorizationStrategy Refers to: common/src/main/java/com/microsoft/identity/common/components/AndroidPlatformComponentsFactory.java:139 in 6aabd68. [](commit_id = 6aabd68, deletion_comment = False) |
done |
@@ -127,14 +128,16 @@ public static void fillBuilderWithBasicImplementations( | |||
.storageSupplier(new AndroidStorageSupplier(context, | |||
new AndroidAuthSdkStorageEncryptionManager(context))) | |||
.platformUtil(new AndroidPlatformUtil(context, activity)) | |||
.httpClientWrapper(new DefaultHttpClientWrapper()); | |||
.httpClientWrapper(new DefaultHttpClientWrapper()) | |||
.browserSelector(new AndroidBrowserSelector(context)); |
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.
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.
when duna is enabled, we need to use the browser selector to check if we have a duna broker available.
see: https://github.com/AzureAD/ad-accounts-for-android/pull/3017/files/70382d1f9a954f545ecb58e7396e54c678a7a802#r1890858348
yes, I can use the same object here
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.
With the changes introduced in AzureAD/microsoft-authentication-library-common-for-android#2564, I broke the MSAL test app, we need to update the signature for Browser selector.
The changes here are the preparatory work for the DUNA feature. Splitting this PR from DUNA to simplify the review process.
AB#3119409