Module: Splunker::Auth

Defined in:
lib/splunker/auth.rb,
lib/splunker/auth/http_auth.rb,
lib/splunker/auth/token_auth.rb,
lib/splunker/auth/splunk_auth.rb

Defined Under Namespace

Classes: HttpAuth, SplunkAuth, TokenAuth

Class Method Summary collapse

Class Method Details

.create(auth_type, client) ⇒ Object

Factory to create a authenticated Request wrapper for a specified auth type. Parameters:

  • auth_type => A symbol representing the auth type to generate. Should be a symbolized

    class name for an existing implementation. (e.g. :http_auth, :token_auth)
    
  • client => A reference to the Splunker client instance.

Returns an instance of the authenticated request wrapper noted by auth_type Raises ArgumentError if auth_type is invalid



17
18
19
20
21
22
23
# File 'lib/splunker/auth.rb', line 17

def self.create(auth_type, client)
  if (obj = Splunker::Auth.const_get("#{auth_type}".split('_').collect(&:capitalize).join))
    obj.new(client)
  else
    raise ArgumentError, "Unknown auth type of #{auth_type}"
  end
end