-
Notifications
You must be signed in to change notification settings - Fork 120
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
Device Code Flow Final PR on MSAL #1112
Conversation
…tion-library-for-android into t-fadura/dcf-main
@t-fadura Is this still WIP? |
All code included so far is completed. I put it as WIP because I have not done the test cases yet. |
What I'm saying is what's already in the PR is ready to be reviewed, there won't be any major changes on my end. |
msal/src/main/java/com/microsoft/identity/client/internal/controllers/LocalMSALController.java
Outdated
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/internal/controllers/LocalMSALController.java
Outdated
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/internal/controllers/LocalMSALController.java
Outdated
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/internal/controllers/LocalMSALController.java
Outdated
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/internal/controllers/LocalMSALController.java
Outdated
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/internal/controllers/LocalMSALController.java
Outdated
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/internal/controllers/LocalMSALController.java
Outdated
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/internal/controllers/LocalMSALController.java
Outdated
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/internal/controllers/LocalMSALController.java
Outdated
Show resolved
Hide resolved
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.
Updated again
...st/java/com/microsoft/identity/client/e2e/shadows/ShadowDeviceCodeFlowCommandTokenError.java
Outdated
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/IPublicClientApplication.java
Outdated
Show resolved
Hide resolved
msal/src/test/java/com/microsoft/identity/client/e2e/tests/mocked/GetDeviceCodeTest.java
Outdated
Show resolved
Hide resolved
msal/src/test/java/com/microsoft/identity/client/e2e/tests/mocked/GetDeviceCodeTest.java
Outdated
Show resolved
Hide resolved
msal/src/test/java/com/microsoft/identity/client/e2e/tests/mocked/DeviceCodeFlowApiTest.java
Outdated
Show resolved
Hide resolved
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.
Left a few comments.
msal/src/test/java/com/microsoft/identity/client/e2e/tests/mocked/DeviceCodeFlowApiTest.java
Outdated
Show resolved
Hide resolved
msal/src/test/java/com/microsoft/identity/client/e2e/tests/mocked/DeviceCodeFlowApiTest.java
Outdated
Show resolved
Hide resolved
msal/src/test/java/com/microsoft/identity/client/e2e/tests/mocked/DeviceCodeFlowApiTest.java
Outdated
Show resolved
Hide resolved
|
||
final String uri = ((AzureActiveDirectoryAuthority) configuration.getAuthorities().get(0)).getAudience().getCloudUrl(); | ||
final Authority authority = Authority.getAuthorityFromAuthorityUrl(uri); | ||
|
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.
Why can't we just use default authority?
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.
Default authority has "common" as tenantID
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.
Default authority would be whatever was declared default in the config....or if there is only one declared then it would be that one authority. It would have common
if the dev put common in the config, otherwise it won't. If it does have common, why is that a problem?
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.
refer to getAuthorityUri()
in AzureActiveDirectoryAuthroity
, this is where the tenant is appended to the end of the authority.
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.
Okay, I'm not completely clear on this. Let's sync up offline.
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.
super.setup(); | ||
|
||
final PublicClientApplicationConfiguration config = mApplication.getConfiguration(); | ||
mUrlBody = ((AzureActiveDirectoryAuthority) config.getAuthorities().get(0)).getAudience().getCloudUrl(); |
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.
Why not config.getDefaultAuthority().getAuthorityUrl().toString()
?
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.
.getAuthorityUrl() is not defined here, checked it in my code
Also tried type casting to AzureActiveDirectoryAuthority
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.
sorry, it was .getAuthorityURL, which returns a url with /common at the end
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.
It probably returns /common at the end because you probably have common in your config. Even if it does, I'm not clear on why that is a problem and why we can't use that?
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.
So that's essentially a developer error right? (They need to make sure they declare the correct authority in the config). In this case, it looks @t-fadura did declare the correct authority. I see his config authority is of the form cloud/tenantId
. So getDefaultAuthority()
should be returning that right?
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.
My bad. I removed my original comment because I thought I was talking about a different thing.
What Fadi was seeing is that somehow his authority has /common appended after tenant id, which is really weird. I'm not familiar with this layer, but most likely there's a bug 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.
Yup, sycned offline with @t-fadura, there's a bug here in MSAL and has been like this forever.
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.
Created GitHub issue: #1121
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.
LGTM 🎉
Final major PR on MSAL as part of my internship project. End-to-end Device Code Flow is working alongside Common PR at: AzureAD/microsoft-authentication-library-common-for-android#983
Since
LocalMsalController
was moved to common, this PR is mainly just test cases now.