Skip to content
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ V.Next
- [PATCH] Move MS STS Response handling to separate class (#2471)
- [MINOR] Add support for email OTP MFA in native authentication (#2468)
- [MINOR] Moving OS version check for passkeys (#2450)
- [MINOR] Support for email OTP MFA in native authentication (#2489)

Version 17.7.0
---------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package com.microsoft.identity.common.nativeauth.internal.commands

import com.microsoft.identity.common.java.logging.LogSession
import com.microsoft.identity.common.java.logging.Logger
import com.microsoft.identity.common.java.nativeauth.commands.parameters.GetAuthMethodsCommandParameters
import com.microsoft.identity.common.java.nativeauth.controllers.results.GetAuthMethodsCommandResult
import com.microsoft.identity.common.java.nativeauth.controllers.results.MFACommandResult
import com.microsoft.identity.common.nativeauth.internal.controllers.NativeAuthMsalController

/**
* Command class to call controllers to trigger /introspect flow.
* {@see com.microsoft.identity.common.java.controllers.CommandDispatcher}.
*/
class GetAuthMethodsCommand(
private val parameters: GetAuthMethodsCommandParameters,
private val controller: NativeAuthMsalController,
publicApiId: String
) : BaseNativeAuthCommand<GetAuthMethodsCommandResult>(
parameters,
controller,
publicApiId
) {

companion object {
private val TAG = GetAuthMethodsCommand::class.java.simpleName
}

/**
* The execution part of the command, to be run on the background thread.
* It calls the getAuthMethods method of the native auth MSAL controller with the given parameters.
*/
override fun execute(): GetAuthMethodsCommandResult {
LogSession.logMethodCall(
tag = TAG,
correlationId = parameters.getCorrelationId(),
methodName = "${TAG}.execute"
)
val result = controller.getAuthMethods(
parameters = parameters
)

Logger.infoWithObject(
TAG,
parameters.getCorrelationId(),
"Returning result: ",
result
)
return result
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package com.microsoft.identity.common.nativeauth.internal.commands

import com.microsoft.identity.common.java.logging.LogSession
import com.microsoft.identity.common.java.logging.Logger
import com.microsoft.identity.common.java.nativeauth.commands.parameters.MFAChallengeCommandParameters
import com.microsoft.identity.common.java.nativeauth.controllers.results.MFAChallengeCommandResult
import com.microsoft.identity.common.java.nativeauth.controllers.results.MFACommandResult
import com.microsoft.identity.common.nativeauth.internal.controllers.NativeAuthMsalController

/**
* Command class to call controllers to trigger /challenge flow.
* {@see com.microsoft.identity.common.java.controllers.CommandDispatcher}.
*/
class MFAChallengeCommand(
private val parameters: MFAChallengeCommandParameters,
private val controller: NativeAuthMsalController,
publicApiId: String
) : BaseNativeAuthCommand<MFAChallengeCommandResult>(
parameters,
controller,
publicApiId
) {

companion object {
private val TAG = MFAChallengeCommand::class.java.simpleName
}

/**
* The execution part of the command, to be run on the background thread.
* It calls the signInChallenge method of the native auth MSAL controller with the given parameters.
*/
override fun execute(): MFAChallengeCommandResult {
LogSession.logMethodCall(
tag = TAG,
correlationId = parameters.getCorrelationId(),
methodName = "${TAG}.execute"
)
val result = controller.signInChallenge(
parameters = parameters
)

Logger.infoWithObject(
TAG,
parameters.getCorrelationId(),
"Returning result: ",
result
)
return result
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation.
// All rights reserved.
//
// This code is licensed under the MIT License.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
package com.microsoft.identity.common.nativeauth.internal.commands

import com.microsoft.identity.common.java.logging.LogSession
import com.microsoft.identity.common.java.logging.Logger
import com.microsoft.identity.common.java.nativeauth.commands.parameters.MFASubmitChallengeCommandParameters
import com.microsoft.identity.common.java.nativeauth.controllers.results.MFASubmitChallengeCommandResult
import com.microsoft.identity.common.nativeauth.internal.controllers.NativeAuthMsalController

/**
* Command class to call controllers to submit the challenge value that the user received to the server, to complete the challenge.
* {@see com.microsoft.identity.common.java.controllers.CommandDispatcher}.
*/
class MFASubmitChallengeCommand(
private val parameters: MFASubmitChallengeCommandParameters,
private val controller: NativeAuthMsalController,
publicApiId: String
) : BaseNativeAuthCommand<MFASubmitChallengeCommandResult>(
parameters,
controller,
publicApiId
) {

companion object {
private val TAG = MFASubmitChallengeCommand::class.java.simpleName
}

/**
* The execution part of the command, to be run on the background thread.
* It calls the signInSubmitChallenge method of the native auth MSAL controller with the given parameters.
*/
override fun execute(): MFASubmitChallengeCommandResult {
LogSession.logMethodCall(
tag = TAG,
correlationId = parameters.getCorrelationId(),
methodName = "${TAG}.execute"
)

val result = controller.signInSubmitChallenge(
parameters = parameters
)

Logger.infoWithObject(
TAG,
parameters.getCorrelationId(),
"Returning result: ",
result
)
return result
}
}
Loading