# Identity v2

## Setup

### Rackspace setup

The first step is to pass in your credentials and set up a client. For Rackspace users, you will need your username and API key:

    use OpenCloud\Rackspace;

    $client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
      'username' => '{username}',
      'apiKey'   => '{apiKey}',
    ));

### OpenStack setup

If you’re an OpenStack user, you will also need to prove a few other configuration parameters:

    $client = new OpenCloud\OpenStack('{keystoneUrl}', array(
      'username' => '{username}',
      'password' => '{apiKey}',
      'tenantId' => '{tenantId}',
    ));

### Identity service

Now to instantiate the Identity service:

    $service = $client->identityService();

## Operations

- Tokens
  - Create token (authenticate)
    - Interacting with the service catalog
    - Interacting with tokens
    - Interacting with users
    - Interacting with tenants
  - Revoke token (destroy session)
- Users
  - Object properties/methods
  - List users
  - Retrieve a user by username
  - Retrieve a user by user ID
  - Retrieve a user by email address
  - Create user
  - Update user
  - Updating a user password
  - Delete user
  - List credentials
  - Get user API key
  - Reset user API key
- Tenants
  - List tenants
  - Tenant object properties and methods

## Glossary

token
  A token is an opaque string that represents an authorization to access cloud resources. Tokens may be revoked at any time and are valid for a finite duration.
tenant
  A tenant is a container used to group or isolate resources and/or identity objects. Depending on the service operator, a tenant may map to a customer, account, organization, or project.
user
  A user is a digital representation of a person, system, or service who consumes cloud services. Users have credentials and may be assigned tokens; based on these credentials and tokens, the authentication service validates that incoming requests are being made by the user who claims to be making the request, and that the user has the right to access the requested resources. Users may be directly assigned to a particular tenant and behave as if they are contained within that tenant.

## Further Links

- Quickstart for the API
- API Developer Guide