Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
AuthTokens Class Reference

Public Member Functions

 __construct (string $root, int $length=10, int $duration=3600, bool $sameOrigin=false)
 AuthTokens constructor.
 
 exists (string $token)
 
 expired (string $token)
 
 store (array $data)
 Stores some data associated to a new token.
 
 remove (string $token)
 Removes an existing token.
 
 fetch ($token)
 Gets the data associated to a token.
 
 setLength (int $length)
 
 setDuration (int $duration)
 
 setSameOrigin (bool $sameOrigin)
 
 setParams (int $length, int $duration, bool $sameOrigin)
 

Data Fields

const CACHE_KEY ='auth'
 

Protected Member Functions

 tokenGenerator ()
 
 getOrigin ()
 
 generateOrigin (array $data)
 
 generateToken ()
 
 getKey (string $token)
 
 isSameOrigin ($data)
 

Protected Attributes

int $length
 
int $duration
 
string $root
 
bool $sameOrigin
 

Detailed Description

Definition at line 10 of file AuthTokens.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( string  $root,
int  $length = 10,
int  $duration = 3600,
bool  $sameOrigin = false 
)

AuthTokens constructor.

Parameters
string$root
int$length
int$duration
bool$sameOrigin

Definition at line 24 of file AuthTokens.php.

Member Function Documentation

◆ exists()

exists ( string  $token)
Parameters
string$token
Returns
bool

Definition at line 78 of file AuthTokens.php.

◆ expired()

expired ( string  $token)
Parameters
string$token
Returns
bool

Definition at line 86 of file AuthTokens.php.

◆ fetch()

fetch (   $token)

Gets the data associated to a token.

Parameters
$token
Returns
false|mixed

Definition at line 126 of file AuthTokens.php.

◆ generateOrigin()

generateOrigin ( array  $data)
protected
Parameters
array$data
Returns
string

Definition at line 50 of file AuthTokens.php.

◆ generateToken()

generateToken ( )
protected
Returns
string
Exceptions

Exception

Definition at line 59 of file AuthTokens.php.

◆ getKey()

getKey ( string  $token)
protected
Parameters
string$token
Returns
string

Definition at line 70 of file AuthTokens.php.

◆ getOrigin()

getOrigin ( )
protected
Returns
string

Definition at line 42 of file AuthTokens.php.

◆ isSameOrigin()

isSameOrigin (   $data)
protected
Parameters
$data
Returns
bool

Definition at line 141 of file AuthTokens.php.

◆ remove()

remove ( string  $token)

Removes an existing token.

Parameters
string$token

Definition at line 116 of file AuthTokens.php.

◆ setDuration()

setDuration ( int  $duration)
Parameters
int$duration

Definition at line 155 of file AuthTokens.php.

◆ setLength()

setLength ( int  $length)
Parameters
int$length

Definition at line 148 of file AuthTokens.php.

◆ setParams()

setParams ( int  $length,
int  $duration,
bool  $sameOrigin 
)

Definition at line 166 of file AuthTokens.php.

◆ setSameOrigin()

setSameOrigin ( bool  $sameOrigin)
Parameters
bool$sameOrigin

Definition at line 162 of file AuthTokens.php.

◆ store()

store ( array  $data)

Stores some data associated to a new token.

Parameters
array$data
Returns
string
Exceptions

Ubiquity\exceptions\CacheException

Definition at line 102 of file AuthTokens.php.

◆ tokenGenerator()

tokenGenerator ( )
protected
Returns
string
Exceptions

Exception

Definition at line 35 of file AuthTokens.php.

Field Documentation

◆ $duration

int $duration
protected

Definition at line 12 of file AuthTokens.php.

◆ $length

int $length
protected

Definition at line 11 of file AuthTokens.php.

◆ $root

string $root
protected

Definition at line 13 of file AuthTokens.php.

◆ $sameOrigin

bool $sameOrigin
protected

Definition at line 14 of file AuthTokens.php.

◆ CACHE_KEY

const CACHE_KEY ='auth'

Definition at line 15 of file AuthTokens.php.


The documentation for this class was generated from the following file: