From a896481167e53cb4380a43d905990489e2d9fbd2 Mon Sep 17 00:00:00 2001 From: fadidurah Date: Tue, 9 Jul 2024 13:46:33 -0400 Subject: [PATCH 1/8] release updates --- common | 2 +- msal/build.gradle | 4 ++-- msal/versioning/version.properties | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common b/common index e72fbf36a7..3109c7b085 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit e72fbf36a7d69993425165b85558d2fc8824074d +Subproject commit 3109c7b085929b07ad2d7bd73af7856bc658f371 diff --git a/msal/build.gradle b/msal/build.gradle index 7eae5c6e95..77fd100509 100644 --- a/msal/build.gradle +++ b/msal/build.gradle @@ -188,12 +188,12 @@ task sourcesJar(type: Jar) { // In dev, we want to keep the dependencies (common4j, common) to 1.0.+ to be able to be consumed by daily dev pipeline. // In release/*, we change these to specific versions being consumed. -def commonVersion = "1.0.+" +def commonVersion = "17.6.0-RC1" if (project.hasProperty("distCommonVersion")) { commonVersion = project.distCommonVersion } // Used for testfixtures -def common4jVersion = "1.0.+" +def common4jVersion = "14.6.0-RC1" if (project.hasProperty("distCommon4jVersion")) { distCommon4jVersion = project.distCommon4jVersion } diff --git a/msal/versioning/version.properties b/msal/versioning/version.properties index af57b7aa69..c6b13163a1 100644 --- a/msal/versioning/version.properties +++ b/msal/versioning/version.properties @@ -1,3 +1,3 @@ #Wed Aug 01 15:24:11 PDT 2018 -versionName=5.4.0 +versionName=5.4.1-RC1 versionCode=0 From 4e337f53631c8ece8a04a09e04108681b1fadebb Mon Sep 17 00:00:00 2001 From: fadidurah Date: Tue, 9 Jul 2024 13:49:34 -0400 Subject: [PATCH 2/8] changelog --- changelog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog b/changelog index cdadd2ce47..92ed807384 100644 --- a/changelog +++ b/changelog @@ -3,6 +3,10 @@ MSAL Wiki : https://github.com/AzureAD/microsoft-authentication-library-for-andr vNext ---------- +Version 5.4.1-RC1 +--------- +- [PATCH] Update common @17.6.0-RC1 + Version 5.4.0 ---------- - [PATCH] Update common @17.5.0 From 33aab214be9374fd513978b52c6fdcbfd4e61316 Mon Sep 17 00:00:00 2001 From: yuxin Date: Thu, 11 Jul 2024 16:53:36 +0100 Subject: [PATCH 3/8] Fix test app issues --- .../EmailAttributeSignUpFragment.kt | 2 +- .../EmailPasswordSignInSignUpFragment.kt | 8 +- .../nativeauth/EmailSignInSignUpFragment.kt | 7 +- .../testapp/nativeauth/SignInCodeFragment.kt | 2 +- .../nativeauth/SignUpAttributesFragment.kt | 45 ++-- .../testapp/nativeauth/SignUpCodeFragment.kt | 3 +- .../main/res/layout/fragment_attribute.xml | 227 +++++++++--------- 7 files changed, 158 insertions(+), 136 deletions(-) diff --git a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailAttributeSignUpFragment.kt b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailAttributeSignUpFragment.kt index 57ba63fa1f..528a6f92fd 100644 --- a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailAttributeSignUpFragment.kt +++ b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailAttributeSignUpFragment.kt @@ -132,7 +132,7 @@ class EmailAttributeSignUpFragment : Fragment() { val actionResult = authClient.signUp( username = email, - password = password, +// password = password, attributes = attributes.build() ) diff --git a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailPasswordSignInSignUpFragment.kt b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailPasswordSignInSignUpFragment.kt index 7ec74a4883..2b14379af1 100644 --- a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailPasswordSignInSignUpFragment.kt +++ b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailPasswordSignInSignUpFragment.kt @@ -120,7 +120,8 @@ class EmailPasswordSignInSignUpFragment : Fragment() { val actionResult = authClient.signIn( username = email, - password = password + password = password, + scopes = listOf("User.Read") ) password.fill('0'); @@ -147,6 +148,9 @@ class EmailPasswordSignInSignUpFragment : Fragment() { ) ) } + else { + displayDialog("Unexpected result", actionResult.errorMessage) + } } else -> { displayDialog( "Unexpected result", actionResult.toString()) @@ -279,6 +283,8 @@ class EmailPasswordSignInSignUpFragment : Fragment() { binding.resultAccessToken.text = getString(R.string.result_access_token_text) + accessToken + Log.d("AccessToken", accessToken) + val idToken = accountState.getIdToken() binding.resultIdToken.text = getString(R.string.result_id_token_text) + idToken } diff --git a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailSignInSignUpFragment.kt b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailSignInSignUpFragment.kt index 4f5ee93812..a16c14dcb2 100644 --- a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailSignInSignUpFragment.kt +++ b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/EmailSignInSignUpFragment.kt @@ -30,11 +30,13 @@ import android.view.View import android.view.ViewGroup import android.widget.Toast import androidx.fragment.app.Fragment +import com.google.android.material.tabs.TabLayout.TabGravity import com.microsoft.identity.client.exception.MsalException import com.microsoft.identity.client.testapp.Constants import com.microsoft.identity.client.testapp.R import com.microsoft.identity.client.testapp.databinding.FragmentEmailSisuBinding import com.microsoft.identity.nativeauth.INativeAuthPublicClientApplication +import com.microsoft.identity.nativeauth.UserAttributes import com.microsoft.identity.nativeauth.statemachine.results.GetAccessTokenResult import com.microsoft.identity.nativeauth.statemachine.results.GetAccountResult import com.microsoft.identity.nativeauth.statemachine.results.SignInResult @@ -112,7 +114,8 @@ class EmailSignInSignUpFragment : Fragment() { val email = binding.emailText.text.toString() val actionResult = authClient.signIn( - username = email + username = email, + scopes = listOf("User.Read") ) when (actionResult) { @@ -250,6 +253,8 @@ class EmailSignInSignUpFragment : Fragment() { binding.resultAccessToken.text = getString(R.string.result_access_token_text) + accessToken + Log.d("AccessToken", accessToken) + val idToken = accountState.getIdToken() binding.resultIdToken.text = getString(R.string.result_id_token_text) + idToken } diff --git a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignInCodeFragment.kt b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignInCodeFragment.kt index 2cea2f3779..63dfdd2ec9 100644 --- a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignInCodeFragment.kt +++ b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignInCodeFragment.kt @@ -56,7 +56,7 @@ class SignInCodeFragment : Fragment() { _binding = FragmentCodeBinding.inflate(inflater, container, false) val bundle = this.arguments - currentState = bundle!!.getSerializable(Constants.STATE) as SignInCodeRequiredState + currentState = (bundle?.getParcelable(Constants.STATE) as? SignInCodeRequiredState)!! codeLength = bundle.getInt(Constants.CODE_LENGTH) sentTo = bundle.getString(Constants.SENT_TO) channel = bundle.getString(Constants.CHANNEL) diff --git a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpAttributesFragment.kt b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpAttributesFragment.kt index 4fd3bfbf52..13b80b2b77 100644 --- a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpAttributesFragment.kt +++ b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpAttributesFragment.kt @@ -40,6 +40,7 @@ import com.microsoft.identity.nativeauth.statemachine.results.SignInResult import com.microsoft.identity.nativeauth.statemachine.results.SignUpResult import com.microsoft.identity.nativeauth.statemachine.states.SignInContinuationState import com.microsoft.identity.nativeauth.statemachine.states.SignUpAttributesRequiredState +import com.microsoft.identity.nativeauth.statemachine.states.SignUpCodeRequiredState import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -57,7 +58,7 @@ class SignUpAttributesFragment : Fragment() { _binding = FragmentAttributeBinding.inflate(inflater, container, false) val bundle = this.arguments - currentState = bundle!!.getSerializable(Constants.STATE) as SignUpAttributesRequiredState + currentState = (bundle?.getParcelable(Constants.STATE) as? SignUpAttributesRequiredState)!! init() @@ -79,21 +80,23 @@ class SignUpAttributesFragment : Fragment() { try { val attributes = UserAttributes.Builder - val attr1Key = binding.attr1KeyText.text.toString() - if (attr1Key.isNotBlank()) { - val attr1Value = binding.attr1ValueText.toString() - attributes - .customAttribute(attr1Key, attr1Value) - } +// val attr1Key = binding.attr1KeyText.text.toString() +// if (attr1Key.isNotBlank()) { +// val attr1Value = binding.attr1ValueText.toString() +// attributes +// .customAttribute(attr1Key, attr1Value) +// } +// +// val attr2Key = binding.attr2KeyText.text.toString() +// if (attr2Key.isNotBlank()) { +// val attr2Value = binding.attr2ValueText.toString() +// attributes +// .customAttribute(attr2Key, attr2Value) +// } - val attr2Key = binding.attr2KeyText.text.toString() - if (attr2Key.isNotBlank()) { - val attr2Value = binding.attr2ValueText.toString() - attributes - .customAttribute(attr2Key, attr2Value) - } + val testAttribute1 = UserAttributes.country("China").build() - val actionResult = currentState.submitAttributes(attributes.build()) + val actionResult = currentState.submitAttributes(testAttribute1) when (actionResult) { is SignUpResult.Complete -> { @@ -105,9 +108,17 @@ class SignUpAttributesFragment : Fragment() { signInAfterSignUp(actionResult.nextState) } is SignUpResult.AttributesRequired -> { - navigateToAttributes( - nextState = actionResult.nextState - ) + val testAttribute2 = UserAttributes.city("Shanghai").build() + val nextState = actionResult.nextState + val result = nextState.submitAttributes(testAttribute2) + if (result is SignUpResult.Complete) { + Toast.makeText( + requireContext(), + getString(R.string.sign_up_successful_message), + Toast.LENGTH_SHORT + ).show() + signInAfterSignUp(result.nextState) + } } else -> { displayDialog(getString(R.string.msal_exception_title),"Unexpected result: $actionResult") diff --git a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpCodeFragment.kt b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpCodeFragment.kt index 5ae35588b6..0f694aee7d 100644 --- a/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpCodeFragment.kt +++ b/testapps/testapp/src/main/java/com/microsoft/identity/client/testapp/nativeauth/SignUpCodeFragment.kt @@ -37,6 +37,7 @@ import com.microsoft.identity.nativeauth.statemachine.errors.SubmitCodeError import com.microsoft.identity.nativeauth.statemachine.results.SignInResult import com.microsoft.identity.nativeauth.statemachine.results.SignUpResendCodeResult import com.microsoft.identity.nativeauth.statemachine.results.SignUpResult +import com.microsoft.identity.nativeauth.statemachine.states.SignInCodeRequiredState import com.microsoft.identity.nativeauth.statemachine.states.SignInContinuationState import com.microsoft.identity.nativeauth.statemachine.states.SignUpAttributesRequiredState import com.microsoft.identity.nativeauth.statemachine.states.SignUpCodeRequiredState @@ -60,7 +61,7 @@ class SignUpCodeFragment : Fragment() { _binding = FragmentCodeBinding.inflate(inflater, container, false) val bundle = this.arguments - currentState = bundle!!.getSerializable(Constants.STATE) as SignUpCodeRequiredState + currentState = (bundle?.getParcelable(Constants.STATE) as? SignUpCodeRequiredState)!! codeLength = bundle.getInt(Constants.CODE_LENGTH) sentTo = bundle.getString(Constants.SENT_TO) channel = bundle.getString(Constants.CHANNEL) diff --git a/testapps/testapp/src/main/res/layout/fragment_attribute.xml b/testapps/testapp/src/main/res/layout/fragment_attribute.xml index b86c044ef1..45b11e39a1 100644 --- a/testapps/testapp/src/main/res/layout/fragment_attribute.xml +++ b/testapps/testapp/src/main/res/layout/fragment_attribute.xml @@ -10,127 +10,126 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +