Class: TrainPlugins::Rest::AuthHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/train-rest/auth_handler.rb

Overview

Class to derive authentication handlers from.

Direct Known Subclasses

Anonymous, Basic, Redfish

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(connection = nil) ⇒ AuthHandler

Returns a new instance of AuthHandler.



8
9
10
# File 'lib/train-rest/auth_handler.rb', line 8

def initialize(connection = nil)
  @connection = connection
end

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



5
6
7
# File 'lib/train-rest/auth_handler.rb', line 5

def connection
  @connection
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/train-rest/auth_handler.rb', line 6

def options
  @options
end

Class Method Details

.descendantsArray

List authentication handlers

Returns:

  • (Array)

    Classes derived from AuthHandler



56
57
58
# File 'lib/train-rest/auth_handler.rb', line 56

def self.descendants
  ObjectSpace.each_object(Class).select { |klass| klass < self }
end

.nameString

Return name of handler

Returns:

  • (String)


15
16
17
# File 'lib/train-rest/auth_handler.rb', line 15

def self.name
  self.to_s.split("::").last.downcase
end

Instance Method Details

#auth_headersHash

Headers added to the rest-client call

Returns:

  • (Hash)


41
42
43
# File 'lib/train-rest/auth_handler.rb', line 41

def auth_headers
  {}
end

#auth_parametersHash

These will get added to the rest-client call.



49
50
51
# File 'lib/train-rest/auth_handler.rb', line 49

def auth_parameters
  { headers: auth_headers }
end

#check_optionsObject

Verify transport options

Raises:

  • (ArgumentError)

    if options are not as needed



30
# File 'lib/train-rest/auth_handler.rb', line 30

def check_options; end

#loginObject

Handle Login



33
# File 'lib/train-rest/auth_handler.rb', line 33

def ; end

#logoutObject

Handle Logout



36
# File 'lib/train-rest/auth_handler.rb', line 36

def logout; end