Class: SignIn::AcrTranslator
- Inherits:
-
Object
- Object
- SignIn::AcrTranslator
- Defined in:
- app/services/sign_in/acr_translator.rb
Instance Attribute Summary collapse
-
#acr ⇒ Object
readonly
Returns the value of attribute acr.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#uplevel ⇒ Object
readonly
Returns the value of attribute uplevel.
Instance Method Summary collapse
-
#initialize(acr:, type:, uplevel: false) ⇒ AcrTranslator
constructor
A new instance of AcrTranslator.
- #perform ⇒ Object
- #translate_acr ⇒ Object private
- #translate_dslogon_values ⇒ Object private
- #translate_idme_values ⇒ Object private
- #translate_logingov_values ⇒ Object private
- #translate_mhv_values ⇒ Object private
Constructor Details
#initialize(acr:, type:, uplevel: false) ⇒ AcrTranslator
Returns a new instance of AcrTranslator.
7 8 9 10 11 |
# File 'app/services/sign_in/acr_translator.rb', line 7 def initialize(acr:, type:, uplevel: false) @acr = acr @type = type @uplevel = uplevel end |
Instance Attribute Details
#acr ⇒ Object (readonly)
Returns the value of attribute acr.
5 6 7 |
# File 'app/services/sign_in/acr_translator.rb', line 5 def acr @acr end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'app/services/sign_in/acr_translator.rb', line 5 def type @type end |
#uplevel ⇒ Object (readonly)
Returns the value of attribute uplevel.
5 6 7 |
# File 'app/services/sign_in/acr_translator.rb', line 5 def uplevel @uplevel end |
Instance Method Details
#perform ⇒ Object
13 14 15 |
# File 'app/services/sign_in/acr_translator.rb', line 13 def perform translate_acr end |
#translate_acr ⇒ Object (private)
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/services/sign_in/acr_translator.rb', line 19 def translate_acr case type when Constants::Auth::IDME translate_idme_values when Constants::Auth::LOGINGOV translate_logingov_values when Constants::Auth::DSLOGON translate_dslogon_values when Constants::Auth::MHV translate_mhv_values else raise Errors::InvalidTypeError.new message: 'Invalid Type value' end end |
#translate_dslogon_values ⇒ Object (private)
47 48 49 50 51 52 53 54 |
# File 'app/services/sign_in/acr_translator.rb', line 47 def translate_dslogon_values case acr when 'loa1', 'loa3', 'min' Constants::Auth::IDME_DSLOGON_LOA1 else raise Errors::InvalidAcrError.new message: 'Invalid ACR for dslogon' end end |
#translate_idme_values ⇒ Object (private)
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/services/sign_in/acr_translator.rb', line 34 def translate_idme_values case acr when 'loa1' Constants::Auth::IDME_LOA1 when 'loa3' Constants::Auth::IDME_LOA3_FORCE when 'min' uplevel ? Constants::Auth::IDME_LOA3 : Constants::Auth::IDME_LOA1 else raise Errors::InvalidAcrError.new message: 'Invalid ACR for idme' end end |
#translate_logingov_values ⇒ Object (private)
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'app/services/sign_in/acr_translator.rb', line 65 def translate_logingov_values case acr when 'ial1' Constants::Auth::LOGIN_GOV_IAL1 when 'ial2' Constants::Auth::LOGIN_GOV_IAL2 when 'min' uplevel ? Constants::Auth::LOGIN_GOV_IAL2 : Constants::Auth::LOGIN_GOV_IAL1 else raise Errors::InvalidAcrError.new message: 'Invalid ACR for logingov' end end |
#translate_mhv_values ⇒ Object (private)
56 57 58 59 60 61 62 63 |
# File 'app/services/sign_in/acr_translator.rb', line 56 def translate_mhv_values case acr when 'loa1', 'loa3', 'min' Constants::Auth::IDME_MHV_LOA1 else raise Errors::InvalidAcrError.new message: 'Invalid ACR for mhv' end end |