Skip to content

Commit

Permalink
added new options
Browse files Browse the repository at this point in the history
  • Loading branch information
harsh62 committed Nov 28, 2023
1 parent cf56827 commit 25043e5
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public struct AWSAuthConfirmSignInOptions {
/// User attributes to be passed in when confirming a sign with NEW_PASSWORD_REQUIRED challenge
public let userAttributes: [AuthUserAttribute]?

/// A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.
public let metadata: [String: String]?

/// Device name that would be provided to Cognito when setting up TOTP
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
import Amplify

public struct AWSAuthConfirmSignInWithMagicLinkOptions {

/// A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.
public let metadata: [String: String]?

public init(metadata: [String: String]? = nil) {
self.metadata = metadata
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Copyright Amazon.com Inc. or its affiliates.
// All Rights Reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
import Amplify

public struct AWSAuthConfirmSignInWithOTPOptions {

/// A map of custom key-value pairs that you can provide as input for any custom workflows that this action triggers.
public let metadata: [String: String]?

public init(metadata: [String: String]? = nil) {
self.metadata = metadata
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class AWSAuthConfirmSignInWithOTPTask: AuthConfirmSignInWithOTPTask, DefaultLogg

private func createConfirmSignInEventData() -> ConfirmSignInEventData {
var passwordlessMetadata = confirmSignInRequestMetadata.toDictionary()
if let customerMetadata = (request.options.pluginOptions as? AWSAuthConfirmSignInOptions)?.metadata {
if let customerMetadata = (request.options.pluginOptions as? AWSAuthConfirmSignInWithOTPOptions)?.metadata {
passwordlessMetadata.merge(customerMetadata, uniquingKeysWith: { passwordlessMetadata, customerMetadata in
// Ideally key collision won't happen, because passwordless has been namespaced
// if for some reason collision still happens,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class AWSAuthConfirmSignInWithOTPTaskTests: BasePluginTest {
})

do {
let confirmSignInOptions = AWSAuthConfirmSignInOptions(metadata: customerMetadata)
let confirmSignInOptions = AWSAuthConfirmSignInWithOTPOptions(
metadata: customerMetadata)
let option = AuthConfirmSignInWithOTPRequest.Options(pluginOptions: confirmSignInOptions)
let confirmSignInResult = try await plugin.confirmSignInWithOTP(
challengeResponse: "code",
Expand Down

0 comments on commit 25043e5

Please sign in to comment.