Class: SignIn::AuthenticationServiceRetriever
- Inherits:
-
Object
- Object
- SignIn::AuthenticationServiceRetriever
- Defined in:
- app/services/sign_in/authentication_service_retriever.rb
Instance Attribute Summary collapse
-
#client_config ⇒ Object
readonly
Returns the value of attribute client_config.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #auth_service ⇒ Object private
- #idme_auth_service ⇒ Object private
-
#initialize(type:, client_config: nil) ⇒ AuthenticationServiceRetriever
constructor
A new instance of AuthenticationServiceRetriever.
- #logingov_auth_service ⇒ Object private
- #logingov_optional_scopes ⇒ Object private
- #mock_auth_service ⇒ Object private
- #perform ⇒ Object
Constructor Details
#initialize(type:, client_config: nil) ⇒ AuthenticationServiceRetriever
Returns a new instance of AuthenticationServiceRetriever.
11 12 13 14 |
# File 'app/services/sign_in/authentication_service_retriever.rb', line 11 def initialize(type:, client_config: nil) @type = type @client_config = client_config end |
Instance Attribute Details
#client_config ⇒ Object (readonly)
Returns the value of attribute client_config.
9 10 11 |
# File 'app/services/sign_in/authentication_service_retriever.rb', line 9 def client_config @client_config end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'app/services/sign_in/authentication_service_retriever.rb', line 9 def type @type end |
Instance Method Details
#auth_service ⇒ Object (private)
26 27 28 29 30 31 32 33 |
# File 'app/services/sign_in/authentication_service_retriever.rb', line 26 def auth_service case type when Constants::Auth::LOGINGOV logingov_auth_service else idme_auth_service end end |
#idme_auth_service ⇒ Object (private)
35 36 37 38 39 40 41 |
# File 'app/services/sign_in/authentication_service_retriever.rb', line 35 def idme_auth_service @idme_auth_service ||= begin @idme_auth_service = Idme::Service.new @idme_auth_service.type = type @idme_auth_service end end |
#logingov_auth_service ⇒ Object (private)
43 44 45 |
# File 'app/services/sign_in/authentication_service_retriever.rb', line 43 def logingov_auth_service @logingov_auth_service ||= Logingov::Service.new(optional_scopes: logingov_optional_scopes) end |
#logingov_optional_scopes ⇒ Object (private)
55 56 57 58 59 |
# File 'app/services/sign_in/authentication_service_retriever.rb', line 55 def logingov_optional_scopes return [] if client_config.blank? client_config.access_token_attributes & Logingov::Service::OPTIONAL_SCOPES end |
#mock_auth_service ⇒ Object (private)
47 48 49 50 51 52 53 |
# File 'app/services/sign_in/authentication_service_retriever.rb', line 47 def mock_auth_service @mock_auth_service ||= begin @mock_auth_service = MockedAuthentication::Credential::Service.new @mock_auth_service.type = type @mock_auth_service end end |
#perform ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/services/sign_in/authentication_service_retriever.rb', line 16 def perform if client_config&.mock_auth? mock_auth_service else auth_service end end |