Class: Splunker::Auth::SplunkAuth

Inherits:
Object
  • Object
show all
Includes:
Request
Defined in:
lib/splunker/auth/splunk_auth.rb

Direct Known Subclasses

HttpAuth, TokenAuth

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Request

#assemble_path, #authenticate, #authenticate_connection, #authenticated?, #get, included, #post, #request, #resource_builder

Constructor Details

#initialize(client) ⇒ SplunkAuth

Parameters:

  • client => An instance of Splunker::Client



11
12
13
# File 'lib/splunker/auth/splunk_auth.rb', line 11

def initialize(client)
  self.client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



6
7
8
# File 'lib/splunker/auth/splunk_auth.rb', line 6

def client
  @client
end

#configuredObject (readonly)

Returns the value of attribute configured.



7
8
9
# File 'lib/splunker/auth/splunk_auth.rb', line 7

def configured
  @configured
end

Instance Method Details

#configurationObject

A helper method to access the client’s configuration. Returns:

  • A Hash of the client’s current configuration settings.



18
19
20
# File 'lib/splunker/auth/splunk_auth.rb', line 18

def configuration
  self.client.configuration
end

#configuration_valid?Boolean

By default, always returns true Child classes must implement their own logic to determine when the client’s configuration is invalid for its needs.

Returns:

  • (Boolean)


39
40
41
# File 'lib/splunker/auth/splunk_auth.rb', line 39

def configuration_valid?
  true
end

#configured?Boolean

Child classes must implement their own logic to determine when

Returns:

  • (Boolean)


24
25
26
# File 'lib/splunker/auth/splunk_auth.rb', line 24

def configured?
  @configured == true
end

#resetObject



43
44
45
# File 'lib/splunker/auth/splunk_auth.rb', line 43

def reset
  @configured = false
end

#verify_configuration!Object

Raises Splunker::Errors::ConfigurationError if configuration_valid? returns false.



30
31
32
33
34
# File 'lib/splunker/auth/splunk_auth.rb', line 30

def verify_configuration!
  unless configuration_valid?
    raise Splunker::Errors::ConfigurationError
  end
end