Credentials

In exchange for a set of authentication credentials that the user submits, the Identity service generates and returns a token. A token represents the authenticated identity of a user and, optionally, grants authorization on a specific project or domain.

More information can be found in the official documentation.

In order to work with credentials you have to create the service first.

Create

Create a secret/access pair for use with ec2 style auth. This operation will generates a new set of credentials that map the user/tenant pair.

$identity = $openstack->identityV3();

$credential = $identity->createCredential([
    'blob'      => '{blob}',
    'projectId' => '{projectId}',
    'type'      => '{type}',
    'userId'    => '{userId}'
]);

Read

Retrieve a user’s access/secret pair by the access key.

$identity = $openstack->identityV3();

$credential = $identity->getCredential('{credentialId}');
$credential->retrieve();

Update

$identity = $openstack->identityV3();

$credential = $identity->getCredential('{credentialId}');

$credential->type = '{type}';
$credential->blob = '{blob}';

$credential->update();

Delete

Delete a user’s access/secret pair.

$identity = $openstack->identityV3();

$credential = $identity->getCredential('credentialId');
$credential->delete();

List

$identity = $openstack->identityV3();

foreach ($identity->listCredentials() as $credential) {
    /** @var $credential \OpenStack\Identity\v3\Models\Credential */
}