-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
f9e5715
commit cf72ceb
Showing
34 changed files
with
3,008 additions
and
19 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
.../src/main/java/com/microsoft/identity/common/internal/commands/SignUpResendCodeCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// 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.internal.commands | ||
|
||
import com.microsoft.identity.common.internal.controllers.NativeAuthMsalController | ||
import com.microsoft.identity.common.java.commands.parameters.nativeauth.SignUpResendCodeCommandParameters | ||
import com.microsoft.identity.common.java.controllers.results.SignUpResendCodeCommandResult | ||
import com.microsoft.identity.common.java.logging.LogSession | ||
import com.microsoft.identity.common.java.logging.Logger | ||
|
||
/** | ||
* Command class to call controllers to resend otp code request in the sign up flow. The resend | ||
* code functionality is used when the user has not received the out of band code. In this case, | ||
* resend functionality allows them to request the same code instead of starting the flow from beginning. | ||
* {@see com.microsoft.identity.common.java.controllers.CommandDispatcher}. | ||
*/ | ||
class SignUpResendCodeCommand( | ||
private val parameters: SignUpResendCodeCommandParameters, | ||
private val controller: NativeAuthMsalController, | ||
publicApiId: String | ||
) : BaseNativeAuthCommand<SignUpResendCodeCommandResult>( | ||
parameters, | ||
controller, | ||
publicApiId | ||
) { | ||
|
||
companion object { | ||
private val TAG = SignUpResendCodeCommand::class.java.simpleName | ||
} | ||
|
||
/** | ||
* The execution part of the command, to be run on the background thread. | ||
* It calls the signUpResendCode method of the native auth MSAL controller with the given parameters. | ||
*/ | ||
override fun execute(): SignUpResendCodeCommandResult { | ||
LogSession.logMethodCall(TAG, "${TAG}.execute") | ||
|
||
val result = controller.signUpResendCode( | ||
parameters = parameters | ||
) | ||
|
||
Logger.info( | ||
TAG, | ||
"Returning result: $result" | ||
) | ||
return result | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
common/src/main/java/com/microsoft/identity/common/internal/commands/SignUpStartCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// 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.internal.commands | ||
|
||
import com.microsoft.identity.common.internal.controllers.NativeAuthMsalController | ||
import com.microsoft.identity.common.java.commands.parameters.nativeauth.BaseSignUpStartCommandParameters | ||
import com.microsoft.identity.common.java.controllers.results.SignUpStartCommandResult | ||
import com.microsoft.identity.common.java.logging.LogSession | ||
import com.microsoft.identity.common.java.logging.Logger | ||
|
||
/** | ||
* Command class to call controllers to start the sign up flow. | ||
* {@see com.microsoft.identity.common.java.controllers.CommandDispatcher}. | ||
*/ | ||
class SignUpStartCommand( | ||
private val parameters: BaseSignUpStartCommandParameters, | ||
private val controller: NativeAuthMsalController, | ||
publicApiId: String | ||
) : BaseNativeAuthCommand<SignUpStartCommandResult>( | ||
parameters, | ||
controller, | ||
publicApiId | ||
) { | ||
|
||
companion object { | ||
private val TAG = SignUpStartCommand::class.java.simpleName | ||
} | ||
|
||
/** | ||
* The execution part of the command, to be run on the background thread. | ||
* It calls the signUpStart method of the native auth MSAL controller with the given parameters. | ||
*/ | ||
override fun execute(): SignUpStartCommandResult { | ||
LogSession.logMethodCall(TAG, "${TAG}.execute") | ||
|
||
val result = controller.signUpStart( | ||
parameters = parameters | ||
) | ||
|
||
Logger.info( | ||
TAG, | ||
"Returning result: $result" | ||
) | ||
return result | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
.../src/main/java/com/microsoft/identity/common/internal/commands/SignUpSubmitCodeCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// 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.internal.commands | ||
|
||
import com.microsoft.identity.common.internal.controllers.NativeAuthMsalController | ||
import com.microsoft.identity.common.java.commands.parameters.nativeauth.SignUpSubmitCodeCommandParameters | ||
import com.microsoft.identity.common.java.controllers.results.SignUpSubmitCodeCommandResult | ||
import com.microsoft.identity.common.java.logging.LogSession | ||
import com.microsoft.identity.common.java.logging.Logger | ||
|
||
/** | ||
* Command class to call controllers to submit the user's otp code to the server in the self service password reset flow. | ||
* {@see com.microsoft.identity.common.java.controllers.CommandDispatcher}. | ||
*/ | ||
class SignUpSubmitCodeCommand( | ||
private val parameters: SignUpSubmitCodeCommandParameters, | ||
private val controller: NativeAuthMsalController, | ||
publicApiId: String | ||
) : BaseNativeAuthCommand<SignUpSubmitCodeCommandResult>( | ||
parameters, | ||
controller, | ||
publicApiId | ||
) { | ||
|
||
companion object { | ||
private val TAG = SignUpSubmitCodeCommand::class.java.simpleName | ||
} | ||
|
||
/** | ||
* The execution part of the command, to be run on the background thread. | ||
* It calls the signUpSubmitCode method of the native auth MSAL controller with the given parameters. | ||
*/ | ||
override fun execute(): SignUpSubmitCodeCommandResult { | ||
LogSession.logMethodCall(TAG, "${TAG}.execute") | ||
|
||
val result = controller.signUpSubmitCode( | ||
parameters = parameters | ||
) | ||
|
||
Logger.info( | ||
TAG, | ||
"Returning result: $result" | ||
) | ||
return result | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
.../main/java/com/microsoft/identity/common/internal/commands/SignUpSubmitPasswordCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// 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.internal.commands | ||
|
||
import com.microsoft.identity.common.internal.controllers.NativeAuthMsalController | ||
import com.microsoft.identity.common.java.commands.parameters.nativeauth.SignUpSubmitPasswordCommandParameters | ||
import com.microsoft.identity.common.java.controllers.results.SignUpSubmitPasswordCommandResult | ||
import com.microsoft.identity.common.java.logging.LogSession | ||
import com.microsoft.identity.common.java.logging.Logger | ||
|
||
/** | ||
* Command class to call controllers to submit the user's password to the server in the self service password reset flow. | ||
* {@see com.microsoft.identity.common.java.controllers.CommandDispatcher}. | ||
*/ | ||
class SignUpSubmitPasswordCommand( | ||
private val parameters: SignUpSubmitPasswordCommandParameters, | ||
private val controller: NativeAuthMsalController, | ||
publicApiId: String | ||
) : BaseNativeAuthCommand<SignUpSubmitPasswordCommandResult>( | ||
parameters, | ||
controller, | ||
publicApiId | ||
) { | ||
|
||
companion object { | ||
private val TAG = SignUpSubmitPasswordCommand::class.java.simpleName | ||
} | ||
|
||
/** | ||
* The execution part of the command, to be run on the background thread. | ||
* It calls the signUpSubmitPassword method of the native auth MSAL controller with the given parameters. | ||
*/ | ||
override fun execute(): SignUpSubmitPasswordCommandResult { | ||
LogSession.logMethodCall(TAG, "${TAG}.execute") | ||
|
||
val result = controller.signUpSubmitPassword( | ||
parameters = parameters | ||
) | ||
|
||
Logger.info( | ||
TAG, | ||
"Returning result: $result" | ||
) | ||
return result | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...java/com/microsoft/identity/common/internal/commands/SignUpSubmitUserAttributesCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// 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.internal.commands | ||
|
||
import com.microsoft.identity.common.internal.controllers.NativeAuthMsalController | ||
import com.microsoft.identity.common.java.commands.parameters.nativeauth.SignUpSubmitUserAttributesCommandParameters | ||
import com.microsoft.identity.common.java.controllers.results.SignUpSubmitUserAttributesCommandResult | ||
import com.microsoft.identity.common.java.logging.LogSession | ||
import com.microsoft.identity.common.java.logging.Logger | ||
|
||
/** | ||
* Command class to call controllers to submit the user's attributes to the server in the sign up flow. | ||
* {@see com.microsoft.identity.common.java.controllers.CommandDispatcher}. | ||
*/ | ||
class SignUpSubmitUserAttributesCommand( | ||
private val parameters: SignUpSubmitUserAttributesCommandParameters, | ||
private val controller: NativeAuthMsalController, | ||
publicApiId: String | ||
) : BaseNativeAuthCommand<SignUpSubmitUserAttributesCommandResult>( | ||
parameters, | ||
controller, | ||
publicApiId | ||
) { | ||
|
||
companion object { | ||
private val TAG = SignUpSubmitUserAttributesCommand::class.java.simpleName | ||
} | ||
|
||
/** | ||
* The execution part of the command, to be run on the background thread. | ||
* It calls the signUpSubmitUserAttributes method of the native auth MSAL controller with the given parameters. | ||
*/ | ||
override fun execute(): SignUpSubmitUserAttributesCommandResult { | ||
LogSession.logMethodCall(TAG, "${TAG}.execute") | ||
|
||
val result = controller.signUpSubmitUserAttributes( | ||
parameters = parameters | ||
) | ||
|
||
Logger.info( | ||
TAG, | ||
"Returning result: $result" | ||
) | ||
return result | ||
} | ||
} |
Oops, something went wrong.