Class: HammerCLIForeman::Api::Authenticator
- Inherits:
-
Object
- Object
- HammerCLIForeman::Api::Authenticator
- Defined in:
- lib/hammer_cli_foreman/api/authenticator.rb
Instance Attribute Summary collapse
-
#auth_type ⇒ Object
Returns the value of attribute auth_type.
-
#settings ⇒ Object
Returns the value of attribute settings.
-
#uri ⇒ Object
Returns the value of attribute uri.
Instance Method Summary collapse
- #fetch ⇒ Object
-
#initialize(auth_type, uri, settings) ⇒ Authenticator
constructor
A new instance of Authenticator.
Constructor Details
#initialize(auth_type, uri, settings) ⇒ Authenticator
Returns a new instance of Authenticator.
5 6 7 8 9 |
# File 'lib/hammer_cli_foreman/api/authenticator.rb', line 5 def initialize(auth_type, uri, settings) @auth_type = auth_type @uri = uri @settings = settings end |
Instance Attribute Details
#auth_type ⇒ Object
Returns the value of attribute auth_type.
4 5 6 |
# File 'lib/hammer_cli_foreman/api/authenticator.rb', line 4 def auth_type @auth_type end |
#settings ⇒ Object
Returns the value of attribute settings.
4 5 6 |
# File 'lib/hammer_cli_foreman/api/authenticator.rb', line 4 def settings @settings end |
#uri ⇒ Object
Returns the value of attribute uri.
4 5 6 |
# File 'lib/hammer_cli_foreman/api/authenticator.rb', line 4 def uri @uri end |
Instance Method Details
#fetch ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/hammer_cli_foreman/api/authenticator.rb', line 11 def fetch if ssl_cert_authentication? && !use_basic_auth? void_auth elsif auth_type == AUTH_TYPES[:basic_auth] basic_auth elsif auth_type == AUTH_TYPES[:basic_auth_external] basic_auth_external elsif auth_type == AUTH_TYPES[:negotiate] negotiate_auth elsif auth_type == AUTH_TYPES[:oauth_password_grant] oauth_password_grant elsif auth_type == AUTH_TYPES[:oauth_authentication_code_grant] oauth_authentication_code_grant end end |