-
Notifications
You must be signed in to change notification settings - Fork 123
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
MFA business logic #2160
Conversation
…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
msal/src/main/java/com/microsoft/identity/client/internal/CommandParametersAdapter.java
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/internal/CommandParametersAdapter.java
Show resolved
Hide resolved
msal/src/main/java/com/microsoft/identity/client/internal/CommandParametersAdapter.java
Show resolved
Hide resolved
@@ -68,6 +70,11 @@ interface SignInResult : Result { | |||
class PasswordRequired( | |||
override val nextState: SignInPasswordRequiredState | |||
) : SignInResult, Result.SuccessResult(nextState = nextState) | |||
|
|||
|
|||
class MFARequired( |
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.
Should this class be called MFARequiredResult
?
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.
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) { |
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 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( |
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.
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> |
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.
Can we make auth method Parcelable?
mockCorrelationId(nextState, correlationId); | ||
|
||
AwaitingMFAStateSendChallengeTestCallback sendChallengeCallback = new AwaitingMFAStateSendChallengeTestCallback(); | ||
nextState.sendChallenge(sendChallengeCallback); |
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.
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
Requires #2158 to be merged first.
MSAL common PR: AzureAD/microsoft-authentication-library-common-for-android#2474