# \genTokenOptions

genTokenOptions Class

This class allow the generation of tokens for openstack, and to inject those tokens into the library. Which allow to do a proper login only once and not for each request

## Summary

Methods
Properties
Constants
__construct()
checkToken()
genIdentityToken()
revokeIdentityToken()
loadIdentityBackup()
genImageToken()
revokeImageToken()
loadImageBackup()
genNetworkToken()
revokeNetworkToken()
loadNetworkBackup()
genComputeToken()
revokeComputeToken()
loadComputeBackup()
getBackup()
loadBackup()
getOptions()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
addDebugMiddleware()
saveBackup()
serializeToken()
unserializeToken()
$optionsGlobal
$backup
$httpClient
N/A

File
  core/LibOverride/genTokenOptions.php
Package
  Default
Class hierarchy
  \genTokenOptions

## Tags

None found

## Properties

### $optionsGlobal

    $optionsGlobal : Array

#### Type

Array — private, contains the options common for the different tokens

#

## Tags

None found

### $backup

    $backup : Array

#### Type

Array — private, contains all the informations about the different tokens. It contains the information send to the clients

#

## Tags

None found

### $httpClient

    $httpClient : \GuzzleHttp\Client

#### Type

\GuzzleHttp\Client — private, contains a default Client to construct some OpenStack library object

#

## Tags

None found

## Methods

### __construct()

    __construct(Array  $options) : \genTokenOptions

genTokenOptions constructor

#### Parameters

Array | $options | Options to create the objects in the library AuthUrl is the main options required

#### Returns

\genTokenOptions —

Object

#

## Tags

None found

### checkToken()

    checkToken() : boolean

Check the expiration time of a token

#### Returns

boolean —

if the token is not expired

#

## Tags

None found

### genIdentityToken()

    genIdentityToken() : void

Generate a new token for the Identity service

#

## Tags

None found

### revokeIdentityToken()

    revokeIdentityToken() : void

Revoke the token for the Identity Service

#

## Tags

None found

### loadIdentityBackup()

    loadIdentityBackup(String  $opt) : void

Load a token for the Identity Service

#### Parameters

String | $opt | serialized token

#

## Tags

None found

### genImageToken()

    genImageToken() : void

Generate a new token for the Image service

#

## Tags

None found

### revokeImageToken()

    revokeImageToken() : void

Revoke the token for the Image Service

#

## Tags

None found

### loadImageBackup()

    loadImageBackup(String  $opt) : void

Load a token for the Image Service

#### Parameters

String | $opt | serialized token

#

## Tags

None found

### genNetworkToken()

    genNetworkToken() : void

Generate a new token for the Metwork service

#

## Tags

None found

### revokeNetworkToken()

    revokeNetworkToken() : void

Revoke the token for the Network Service

#

## Tags

None found

### loadNetworkBackup()

    loadNetworkBackup(String  $opt) : void

Load a token for the Network Service

#### Parameters

String | $opt | serialized token

#

## Tags

None found

### genComputeToken()

    genComputeToken() : void

Generate a new token for the Compute service

#

## Tags

None found

### revokeComputeToken()

    revokeComputeToken() : void

Revoke the token for the Compute Service

#

## Tags

None found

### loadComputeBackup()

    loadComputeBackup(String  $opt) : void

Load a token for the Compute Service

#### Parameters

String | $opt | serialized token

#

## Tags

None found

### getBackup()

    getBackup() : String

Retrieve the tokens saved

#### Returns

String —

tokens serialized

#

## Tags

None found

### loadBackup()

    loadBackup(String  $back) : void

Load tokens into the library

#### Parameters

String | $back | tokens serialized

#

## Tags

None found

### getOptions()

    getOptions(String  $service) : array

Retrieve the common options for a service

#### Parameters

String | $service | name of the service

#### Returns

array —

Options to create the library class corresponding to this service

#

## Tags

None found

### addDebugMiddleware()

    addDebugMiddleware(array  $options, \OpenCloud\Common\Transport\HandlerStack  $stack) : void

Add a debug for the library

#### Parameters

array | $options | Debug options, cf library
\OpenCloud\Common\Transport\HandlerStack | $stack | pointer to a HandlerStack object

#

## Tags

None found

### saveBackup()

    saveBackup(String  $name, Array  $data) : void

Save the token given a service name

#### Parameters

String | $name | name of the service to save
Array | $data | token and baseUrl for the service

#

## Tags

None found

### serializeToken()

    serializeToken(Array  $token) : String

Serialize a given token

#### Parameters

Array | $token | token to be serialized

#### Returns

String —

token serialized

#

## Tags

None found

### unserializeToken()

    unserializeToken(String  $tokenSerialized) : \OpenCloud\Common\Auth\Token

Unserialize a token

Unserialize a token and recreate the architecture of the library token

#### Parameters

String | $tokenSerialized | the token to be unserialized

#### Returns

\OpenCloud\Common\Auth\Token —

the token unserialized

#

## Tags

None found

### genTokenOptions.php