IdentityServices Class
Interact with Identity Services (a.k.a. Keystone) for authentication, obtaining the service catalog, etc.
Constructor
IdentityServices
-
endpoint
Parameters:
-
endpointStringAn 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:
-
optsObjectAn object with the opts to pass to the transport layer.
-
bodyStringThe body of the request. If JSON than in string form.
-
fnFunctionA 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:
-
objObjectThe 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:
-
optionsObjectThe options to use when authenticating.
-
fnFunctionThe 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:
-
accountStringThe account to authenticate with.
-
secretStringThe secret key associated with the account.
-
fnFunctionA 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:
-
usernameStringThe username to authenticate with.
-
passwordStringThe users password associated with the username.
-
fnFunctionA 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:
-
identityIdentityThe Identity object
-
fnFunctionA 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:
-
idStringThe 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:
-
nameStringThe 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:
-
identityObjectAn identity object.
-
fnFunctionThe 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.
HPCloud-JS