-
Notifications
You must be signed in to change notification settings - Fork 126
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
Signup for NativeAuth #1949
Signup for NativeAuth #1949
Conversation
import com.microsoft.identity.common.java.providers.nativeauth.responses.UserAttributeApiResult | ||
|
||
/** | ||
* RequiredUserAttribute represents details about the account attributes required by the server. |
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.
I'm not sure what we mean by these being required. There is a boolean flag here..so if require boolean was false then will these still be considered required?
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.
These attributes are requested (required) by the server so they are called RequiredUserAttribute
. The required field denotes whether it is mandatory for the attribute to be sent. The class names reflect the attribute names we get from the REST APIs.
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 the boolean here will always be true. Honestly the naming here is too confusing. It sounds like the required boolean means something else but I'm not sure what it means
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.
I agree the naming is a bit confusing but it represents the attribute names from the REST API. I will talk to API folks to see if we can rename it. That change will be outside of this PR.
@@ -0,0 +1,132 @@ | |||
package com.microsoft.identity.client |
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.
LICENSE
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.
Added
|
||
/** | ||
* Native Auth uses a state machine to denote state and transitions for a user. | ||
* SignInAfterSignUpState class represents a state where the user must signin after successful |
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 we don't automatically sign the user in ourself as part of sign up?
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.
From user's perspective we do. The signup operation will provide a short lived token to the sign in process and that will complete the sign in. It will be completely transparent to the user.
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 the client app developer doesn't have to invoke the SignInAfterSignupState?
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, the client doesn't have to invoke SignInAfterSignupState
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.
I believe we also make sure documentation in customer-facing methods doesn't refer to the SLT token directly, Seems we refere to it as verification code 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.
I think they would still have to invoke the sign in method from signInAfterSignupState, how else would they pass scopes when signing in.
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.
The token names are being changed to continuation_token. I was wrong in the previous comment. The developer has to call signin method after successful signup operation.
This PR includes the work for Signup related features of Native Auth. No new dependencies have been added as part of this PR. A technical overview of Native Auth is available at https://dev.azure.com/IdentityDivision/DevEx/_git/AuthLibrariesApiReview?path=/%5BAndroid%5D%20Native%20authentication/technical_overview.md&version=GBsammy/native-authentication&_a=preview A companion PR in MSAL is AzureAD/microsoft-authentication-library-for-android#1949
msal/src/main/java/com/microsoft/identity/client/NativeAuthPublicClientApplication.kt
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/statemachine/states/SignUpStates.kt
Show resolved
Hide resolved
internal fun List<UserAttributeApiResult>.toListOfRequiredUserAttribute(): List<RequiredUserAttribute> { | ||
return this.map { it.toRequiredUserAttribute() } | ||
} | ||
|
||
internal fun UserAttributeApiResult.toRequiredUserAttribute(): RequiredUserAttribute { |
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.
Javadoc on these two methods
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
} | ||
|
||
internal fun UserAttributes.toMap(): Map<String, String> { | ||
return ObjectMapper.constructMapFromObject(userAttributes) |
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.
wasn't userAttributes
already declared as a Map?
@@ -357,6 +364,220 @@ public static DeviceCodeFlowCommandParameters createDeviceCodeFlowCommandParamet | |||
return commandParameters; | |||
} | |||
|
|||
/** | |||
* Creates command parameter for [SignUpStartCommand] of Native Auth. |
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.
You can use {@link SignUpStartCommand}
to actually link to that file from within the javadoc....here and everywhere
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
import com.microsoft.identity.client.statemachine.states.SignUpPasswordRequiredState | ||
|
||
/** | ||
* Sign up start result, produced by |
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.
Sign up start result or just sign up result?
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
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.
Approved with comments
This PR is to merge the SignIn, SIgnup and SSPR code into dev branch. This code was previously reviewed in #1897, #1919, #1949 and #1950 . A technical overview of Native Auth is available at https://dev.azure.com/IdentityDivision/DevEx/_git/AuthLibrariesApiReview?path=/%5BAndroid%5D%20Native%20authentication/technical_overview.md&version=GBsammy/native-authentication&_a=preview A companion PR in common repo is AzureAD/microsoft-authentication-library-common-for-android#2233 --------- Co-authored-by: melissaahn <[email protected]> Co-authored-by: iamgusain <[email protected]> Co-authored-by: Dome Pongmongkol <[email protected]> Co-authored-by: Sowmya Malayanur <[email protected]> Co-authored-by: Mohit <[email protected]> Co-authored-by: tanmaymanolkar1 <[email protected]> Co-authored-by: amoyixi <[email protected]> Co-authored-by: yixilin <[email protected]> Co-authored-by: fadidurah <[email protected]> Co-authored-by: Dean Xu <[email protected]> Co-authored-by: Neha Goel <[email protected]> Co-authored-by: Dome Pongmongkol <[email protected]> Co-authored-by: pedro romero vargas <[email protected]>
This PR includes the work for Signup related features of Native Auth. No new dependencies have been added as part of this PR.
A technical overview of Native Auth is available at https://dev.azure.com/IdentityDivision/DevEx/_git/AuthLibrariesApiReview?path=/%5BAndroid%5D%20Native%20authentication/technical_overview.md&version=GBsammy/native-authentication&_a=preview
A companion PR in MSAL Common is AzureAD/microsoft-authentication-library-common-for-android#2229