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

Signup for NativeAuth #1949

Merged
merged 7 commits into from
Nov 28, 2023
Merged

Signup for NativeAuth #1949

merged 7 commits into from
Nov 28, 2023

Conversation

SaurabhMSFT
Copy link
Contributor

@SaurabhMSFT SaurabhMSFT commented Nov 10, 2023

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

@github-actions github-actions bot added the msal label Nov 10, 2023
import com.microsoft.identity.common.java.providers.nativeauth.responses.UserAttributeApiResult

/**
* RequiredUserAttribute represents details about the account attributes required by the server.
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

LICENSE

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

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, the client doesn't have to invoke SignInAfterSignupState

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

SaurabhMSFT added a commit to AzureAD/microsoft-authentication-library-common-for-android that referenced this pull request Nov 23, 2023
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
Comment on lines 44 to 48
internal fun List<UserAttributeApiResult>.toListOfRequiredUserAttribute(): List<RequiredUserAttribute> {
return this.map { it.toRequiredUserAttribute() }
}

internal fun UserAttributeApiResult.toRequiredUserAttribute(): RequiredUserAttribute {
Copy link
Contributor

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

Copy link
Contributor Author

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)
Copy link
Contributor

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.
Copy link
Contributor

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

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Copy link
Contributor

@shahzaibj shahzaibj left a comment

Choose a reason for hiding this comment

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

Approved with comments

@SaurabhMSFT SaurabhMSFT merged commit e48f199 into ciam-feature Nov 28, 2023
9 checks passed
@SaurabhMSFT SaurabhMSFT deleted the saugautam/2642913 branch November 28, 2023 23:09
SaurabhMSFT added a commit that referenced this pull request Dec 6, 2023
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants