Class: Splunker::Auth::HttpAuth
- Inherits:
-
SplunkAuth
- Object
- SplunkAuth
- Splunker::Auth::HttpAuth
- Defined in:
- lib/splunker/auth/http_auth.rb
Overview
Wraps Splunk API requests with basic authentication
Instance Attribute Summary
Attributes inherited from SplunkAuth
Instance Method Summary collapse
- #authenticate_connection(conn) ⇒ Object
- #configuration_valid? ⇒ Boolean
- #verify_configuration! ⇒ Object
Methods inherited from SplunkAuth
#configuration, #configured?, #initialize, #reset
Methods included from Request
#assemble_path, #authenticate, #authenticated?, #get, included, #post, #request, #resource_builder
Constructor Details
This class inherits a constructor from Splunker::Auth::SplunkAuth
Instance Method Details
#authenticate_connection(conn) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/splunker/auth/http_auth.rb', line 5 def authenticate_connection(conn) return if self.configured? conn.basic_auth(configuration[:username], configuration[:password]) @configured = true end |
#configuration_valid? ⇒ Boolean
12 13 14 15 |
# File 'lib/splunker/auth/http_auth.rb', line 12 def configuration_valid? !configuration[:username].nil? && !configuration[:password].nil? end |
#verify_configuration! ⇒ Object
17 18 19 20 21 22 |
# File 'lib/splunker/auth/http_auth.rb', line 17 def verify_configuration! unless configuration_valid? raise Splunker::Errors::ConfigurationError, "HttpAuth requires both :username and :password configuration options be set" end end |