Class: AWSCDK::Cognito::MfaSecondFactor

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cognito/mfa_second_factor.rb

Overview

The different ways in which a user pool can obtain their MFA token for sign in.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(otp:, sms:, email: nil) ⇒ MfaSecondFactor

Returns a new instance of MfaSecondFactor.

Parameters:

  • otp (Boolean)

    The MFA token is a time-based one time password that is generated by a hardware or software token.

  • sms (Boolean)

    The MFA token is sent to the user via SMS to their verified phone numbers.

  • email (Boolean, nil) (defaults to: nil)

    The MFA token is sent to the user via EMAIL.



12
13
14
15
16
17
18
19
# File 'cognito/mfa_second_factor.rb', line 12

def initialize(otp:, sms:, email: nil)
  @otp = otp
  Jsii::Type.check_type(@otp, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "otp")
  @sms = sms
  Jsii::Type.check_type(@sms, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "sms")
  @email = email
  Jsii::Type.check_type(@email, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJib29sZWFuIn0=")), "email") unless @email.nil?
end

Instance Attribute Details

#emailBoolean? (readonly)

Note:

Default: false

The MFA token is sent to the user via EMAIL.

To enable email-based MFA, set email property to the Amazon SES email-sending configuration and set feture_plan to FeaturePlan.ESSENTIALS or FeaturePlan.PLUS



41
42
43
# File 'cognito/mfa_second_factor.rb', line 41

def email
  @email
end

#otpBoolean (readonly)

Note:

Default: false

The MFA token is a time-based one time password that is generated by a hardware or software token.



26
27
28
# File 'cognito/mfa_second_factor.rb', line 26

def otp
  @otp
end

#smsBoolean (readonly)

Note:

Default: true

The MFA token is sent to the user via SMS to their verified phone numbers.



32
33
34
# File 'cognito/mfa_second_factor.rb', line 32

def sms
  @sms
end

Class Method Details

.jsii_propertiesObject



43
44
45
46
47
48
49
# File 'cognito/mfa_second_factor.rb', line 43

def self.jsii_properties
  {
    :otp => "otp",
    :sms => "sms",
    :email => "email",
  }
end

Instance Method Details

#to_jsiiObject



51
52
53
54
55
56
57
58
59
# File 'cognito/mfa_second_factor.rb', line 51

def to_jsii
  result = {}
  result.merge!({
    "otp" => @otp,
    "sms" => @sms,
    "email" => @email,
  })
  result.compact
end