Class: HammerCLIForeman::Api::NegotiateAuth
- Inherits:
-
ApipieBindings::Authenticators::Negotiate
- Object
- ApipieBindings::Authenticators::Negotiate
- HammerCLIForeman::Api::NegotiateAuth
- Defined in:
- lib/hammer_cli_foreman/api/negotiate_auth.rb
Instance Method Summary collapse
- #error(ex) ⇒ Object
-
#initialize(foreman_url, **options) ⇒ NegotiateAuth
constructor
A new instance of NegotiateAuth.
- #session_id ⇒ Object
- #status ⇒ Object
- #user ⇒ Object
Constructor Details
#initialize(foreman_url, **options) ⇒ NegotiateAuth
Returns a new instance of NegotiateAuth.
4 5 6 |
# File 'lib/hammer_cli_foreman/api/negotiate_auth.rb', line 4 def initialize(foreman_url, **) super("#{foreman_url}/api/users/extlogin", HammerCLI::SSLOptions.new.(foreman_url).merge()) end |
Instance Method Details
#error(ex) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/hammer_cli_foreman/api/negotiate_auth.rb', line 24 def error(ex) super unless ex.is_a?(RestClient::Unauthorized) = _('Invalid username or password.') begin = JSON.parse(ex.response.body)['error']['message'] rescue end UnauthorizedError.new() end |
#session_id ⇒ Object
12 13 14 |
# File 'lib/hammer_cli_foreman/api/negotiate_auth.rb', line 12 def session_id &.delete_prefix('_session_id=') end |
#status ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/hammer_cli_foreman/api/negotiate_auth.rb', line 16 def status if system('klist') _('No session, but there is an active Kerberos session, that will be used for negotiate login.') else _('There is no active Kerberos session. Have you run %s?') % 'kinit' end end |
#user ⇒ Object
8 9 10 |
# File 'lib/hammer_cli_foreman/api/negotiate_auth.rb', line 8 def user _('current Kerberos user') end |