class Miasma::Contrib::OpenStackApiCore::Authenticate

Authentication helper class

Attributes

credentials[R]

@return [Smash] credentials in use

token[R]

@return [Smash] token info

Public Class Methods

new(credentials) click to toggle source

Create new instance

@return [self]

# File lib/miasma/contrib/open_stack.rb, line 22
def initialize(credentials)
  @credentials = credentials.to_smash
end

Public Instance Methods

api_token() click to toggle source

@return [String] current API token

# File lib/miasma/contrib/open_stack.rb, line 39
def api_token
  if(token.nil? || Time.now > token[:expires])
    identify_and_load
  end
  token[:id]
end
authentication_request() click to toggle source

@return [Smash] authentication request body

# File lib/miasma/contrib/open_stack.rb, line 55
def authentication_request
  raise NotImplementedError
end
identity_and_load() click to toggle source

Identify with authentication endpoint and load the service catalog

@return [self]

# File lib/miasma/contrib/open_stack.rb, line 50
def identity_and_load
  raise NotImplementedError
end
service_catalog() click to toggle source

@return [Smash] remote service catalog

# File lib/miasma/contrib/open_stack.rb, line 33
def service_catalog
  load!
  @service_catalog
end
user() click to toggle source

@return [String] username

# File lib/miasma/contrib/open_stack.rb, line 27
def user
  load!
  @user
end

Protected Instance Methods

load!() click to toggle source

@return [TrueClass] load authenticator

# File lib/miasma/contrib/open_stack.rb, line 62
def load!
  !!api_token
end