class OpenStack::Keystone::Public::Auth

End user authentication

Public Instance Methods

endpoint_for(endpoint_type, region=nil) click to toggle source

Returns the first endpoint for current authentication and for a given endpoint_type and region

Attributes

  • endpoint_type - The type of endpoint. Currently valid values are: “Compute”, “Volume”

  • region - Restrict the search to given a region (can be omitted)

# File lib/open_stack/keystone/public/auth.rb, line 124
def endpoint_for(endpoint_type, region=nil)
  endpoints_for(endpoint_type, region)[0]
end
endpoints_for(endpoint_type, region=nil) click to toggle source

Returns the list of endpoint for current authentication and for a given endpoint_type and region

Attributes

  • endpoint_type - The type of endpoint. Currently valid values are: “Compute”, “Volume”

  • region - Restrict the search to given a region (can be omitted)

# File lib/open_stack/keystone/public/auth.rb, line 102
def endpoints_for(endpoint_type, region=nil)
  return [] unless service_catalog.present?

  endpoints = []
  service_catalog.each { |c|
    next if c.attributes[:type] != endpoint_type

    c.endpoints.each { |e|
      if region.nil? or e.region == region
        endpoints << e
      end
    }
  }

  endpoints
end
service_catalog() click to toggle source

Returns the service catalog for current authentication

# File lib/open_stack/keystone/public/auth.rb, line 83
def service_catalog
  @attributes[:serviceCatalog].is_a?(Array) ? @attributes[:serviceCatalog] : []
end
token() click to toggle source

Returns the OpenStack::Keystone::Public::Auth::Token instance for current authentication

# File lib/open_stack/keystone/public/auth.rb, line 88
def token
  @attributes[:token]
end
token_id() click to toggle source

Returns the token_id (string) for current authentication

# File lib/open_stack/keystone/public/auth.rb, line 93
def token_id
  token.id if token.present?
end

Protected Instance Methods

initialize(attributes = {}, persisted = false) click to toggle source
Calls superclass method
# File lib/open_stack/keystone/public/auth.rb, line 39
def initialize(attributes = {}, persisted = false) # :notnew:
  attributes[:username] ||= ""
  attributes[:password] ||= ""

  if attributes[:tenant].present?
    attributes[:tenant_id] = attributes[:tenant].id
  elsif attributes[:tenant_id].present?
    attributes[:tenant_id] = attributes[:tenant_id]
  end

  super(attributes, persisted)
end