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

MFA business logic #2160

Merged
merged 23 commits into from
Aug 28, 2024
Merged

MFA business logic #2160

merged 23 commits into from
Aug 28, 2024

Conversation

SammyO
Copy link
Contributor

@SammyO SammyO commented Aug 13, 2024

Requires #2158 to be merged first.

MSAL common PR: AzureAD/microsoft-authentication-library-common-for-android#2474

…iness-logic

# Conflicts:
#	msal/src/main/java/com/microsoft/identity/nativeauth/NativeAuthPublicClientApplication.kt
#	msal/src/main/java/com/microsoft/identity/nativeauth/statemachine/errors/SignInErrors.kt
#	msal/src/main/java/com/microsoft/identity/nativeauth/statemachine/states/MFAStates.kt
#	msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInTest.kt
@SammyO SammyO marked this pull request as ready for review August 14, 2024 15:57
@SammyO SammyO requested review from a team as code owners August 14, 2024 15:57
@SammyO SammyO requested a review from nilo-ms August 14, 2024 15:57
@@ -68,6 +70,11 @@ interface SignInResult : Result {
class PasswordRequired(
override val nextState: SignInPasswordRequiredState
) : SignInResult, Result.SuccessResult(nextState = nextState)


class MFARequired(
Copy link

Choose a reason for hiding this comment

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

Should this class be called MFARequiredResult?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. Our structure is Result., e.g. SignInResult.PasswordRequired. In this case it's SignInResult.MFARequired.

* @param callback [com.microsoft.identity.nativeauth.statemachine.states.MFARequiredState.SendChallengeCallback] to receive the result on.
* @return The result of the send challenge action.
*/
fun sendChallenge(authMethodId: String? = null, callback: SendChallengeCallback) {
Copy link

Choose a reason for hiding this comment

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

Why not consider using the authMethod instance as a parameter instead of the String id? There don't seem to be significant drawbacks, and the advantages include not having to validate the authMethodId since it's exclusively created by the SDK.

/**
* RequiredUserAttribute represents details about the account attributes required by the server.
*/
data class AuthMethod(
Copy link

Choose a reason for hiding this comment

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

nit: I don't know if you align file name to class name, but the file name has an "s" while the class name doesn't

# Conflicts:
#	msal/src/main/java/com/microsoft/identity/nativeauth/AuthMethods.kt
#	msal/src/main/java/com/microsoft/identity/nativeauth/statemachine/errors/MFAErrors.kt
#	msal/src/main/java/com/microsoft/identity/nativeauth/statemachine/results/MFAResult.kt
#	msal/src/main/java/com/microsoft/identity/nativeauth/statemachine/results/SignInResult.kt
#	msal/src/main/java/com/microsoft/identity/nativeauth/statemachine/states/MFAStates.kt
#	msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInTest.kt
*
* @param nextState [com.microsoft.identity.nativeauth.statemachine.states.MFARequiredState] the current state of the flow with follow-on methods.
* @param authMethods the authentication methods that can be used to complete the challenge flow.
*/
class SelectionRequired(
override val nextState: MFARequiredState,
val authMethods: List<AuthMethod>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we make auth method Parcelable?

mockCorrelationId(nextState, correlationId);

AwaitingMFAStateSendChallengeTestCallback sendChallengeCallback = new AwaitingMFAStateSendChallengeTestCallback();
nextState.sendChallenge(sendChallengeCallback);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

rename to requestChallenge()

# Conflicts:
#	msal/src/main/java/com/microsoft/identity/client/internal/CommandParametersAdapter.java
#	msal/src/test/java/com/microsoft/identity/client/e2e/tests/network/nativeauth/SignInEmailPasswordTest.kt
#	msal/src/test/java/com/microsoft/identity/nativeauth/NativeAuthPublicClientApplicationJavaTest.java
SammyO added a commit to AzureAD/microsoft-authentication-library-common-for-android that referenced this pull request Aug 28, 2024
@SammyO SammyO merged commit 5dfc75c into sammy/mfa-epic Aug 28, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants