IdentityServices Class
Interact with Identity Services (a.k.a. Keystone) for authentication, obtaining the service catalog, etc.
Constructor
IdentityServices
-
endpoint
Parameters:
-
endpoint
StringAn identity services url endpoint.
Item Index
Methods
$basicHeaders
()
Object
private
The basic headers to use when making calls.
This is an internal method that should not be called by other methods.
Returns:
$request
-
opts
-
body
-
fn
Do an identity request.
This is an internal method that should not be called by other methods.
Parameters:
-
opts
ObjectAn object with the opts to pass to the transport layer.
-
body
StringThe body of the request. If JSON than in string form.
-
fn
FunctionA callback function to execute after the request. The callback accepts two params. The first is error and contains the error if there is one. If the request was successful the first param is false and the second param is an Identity object.
$tenant
-
obj
Attach a tenant to an object. This is a helper method used when authenticating.
This is an internal method that should not be called by other methods.
Parameters:
-
obj
ObjectThe object to attach tenant information to.
authenticate
-
options
-
fn
Authenticate to a server.
This is a raw authentication method. It users ONLY the options passed in to authenticate.
The autheticateAs* methods are recommended.
Parameters:
-
options
ObjectThe options to use when authenticating.
-
fn
FunctionThe callback function to execute after authentication. The callback accepts two params. The first is error and contains the error if there is one. If the request was successful the first param is false and the second param is an Identity object.
authenticateAsAccount
-
account
-
secret
-
fn
Authenticate using account/secret keys.
To attach to a project (tenant), use setTenantId() or setTenantName() first.
Parameters:
-
account
StringThe account to authenticate with.
-
secret
StringThe secret key associated with the account.
-
fn
FunctionA callback function to execute after a user authenticates. The callback accepts two params. The first is error and contains the error if there is one. If the request was successful the first param is false and the second param is an Identity object.
authenticateAsUser
-
username
-
password
-
fn
Authenticate using user/password.
To attach to a project (tenant), use setTenantId() or setTenantName() first.
Parameters:
-
username
StringThe username to authenticate with.
-
password
StringThe users password associated with the username.
-
fn
FunctionA callback function to execute after a user authenticates. The callback accepts two params. The first is error and contains the error if there is one. If the request was successful the first param is false and the second param is an Identity object.
rescope
-
identity
-
fn
Rescope a user from one tenant to another.
Parameters:
-
identity
IdentityThe Identity object
-
fn
FunctionA callback function to execute after rescoping the identity.
setTenantId
-
id
Set the tenant ID.
Only one of tenant name and tenant ID should be set.
This should be done before an authentication call.
Parameters:
-
id
StringThe tenantId to be used.
Returns:
setTenantName
-
name
Set the tenant Name.
Only one of tenant name and tenant ID should be set.
This should be done before an authentication call.
Parameters:
-
name
StringThe tenantName to be used.
Returns:
tenantId
()
String
Get the tenantId.
Returns:
tenantName
()
String
Get the tenantName.
Returns:
tenants
-
identity
-
fn
Get the list of tenants for an identity.
A tenant object looks like this:
Parameters:
-
identity
ObjectAn identity object.
-
fn
FunctionThe callback function. This will be invoked with a list of tenant objects:
fn(error, tenants)
Returns:
Example:
{ id: 'TENANT_ID', name: 'TENANT NAME', enabled: true, created: TIMESTAMP, updated: TIMESTAMP }
url
()
String
Get the endpoint URL.