ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
A class that generates and verifies time-limited tokens. More...
Public Member Functions | |
__construct ($lifetime=900, $secretSalt=null, $skew=1, $algo='sha1') | |
Create a new time-limited token. More... | |
addVerificationData ($data) | |
Add some given data to the current token. More... | |
generate () | |
Generates a token that contains an offset and a token value, using the current offset. More... | |
generate_token () | |
validate ($token) | |
Validates a token by calculating the token value for the provided offset and comparing it. More... | |
validate_token ($token) | |
Protected Attributes | |
$secretSalt | |
$lifetime | |
$skew | |
$algo | |
Private Member Functions | |
calculateTokenValue ($offset, $time=null) | |
Calculates a token value for a given offset. More... | |
A class that generates and verifies time-limited tokens.
Definition at line 8 of file TimeLimitedToken.php.
SimpleSAML\Auth\TimeLimitedToken::__construct | ( | $lifetime = 900 , |
|
$secretSalt = null , |
|||
$skew = 1 , |
|||
$algo = 'sha1' |
|||
) |
Create a new time-limited token.
Please note that the default algorithm will change in SSP 1.15.0 to SHA-256 instead of SHA-1.
int | $lifetime | Token lifetime in seconds. Defaults to 900 (15 min). |
string | $secretSalt | A random and unique salt per installation. Defaults to the salt in the configuration. |
int | $skew | The allowed time skew (in seconds) to correct clock deviations. Defaults to 1 second. |
string | $algo | The hash algorithm to use to generate the tokens. Defaults to SHA-1. |
Definition at line 44 of file TimeLimitedToken.php.
References SimpleSAML\Auth\TimeLimitedToken\$algo, SimpleSAML\Auth\TimeLimitedToken\$lifetime, SimpleSAML\Auth\TimeLimitedToken\$secretSalt, SimpleSAML\Auth\TimeLimitedToken\$skew, and SimpleSAML\Utils\Config\getSecretSalt().
SimpleSAML\Auth\TimeLimitedToken::addVerificationData | ( | $data | ) |
Add some given data to the current token.
This data will be needed later too for token validation.
This mechanism can be used to provide context for a token, such as a user identifier of the only subject authorised to use it. Note also that multiple data can be added to the token. This means that upon validation, not only the same data must be added, but also in the same order.
string | $data | The data to incorporate into the current token. |
Definition at line 70 of file TimeLimitedToken.php.
|
private |
Calculates a token value for a given offset.
int | $offset | The offset to use. |
int | null | $time | The time stamp to which the offset is relative to. Defaults to the current time. |
Definition at line 84 of file TimeLimitedToken.php.
References $time, GuzzleHttp\Psr7\hash(), and time.
Referenced by SimpleSAML\Auth\TimeLimitedToken\generate(), and SimpleSAML\Auth\TimeLimitedToken\validate().
SimpleSAML\Auth\TimeLimitedToken::generate | ( | ) |
Generates a token that contains an offset and a token value, using the current offset.
Definition at line 102 of file TimeLimitedToken.php.
References SimpleSAML\Auth\TimeLimitedToken\$skew, $time, SimpleSAML\Auth\TimeLimitedToken\calculateTokenValue(), and time.
Referenced by SimpleSAML\Auth\TimeLimitedToken\generate_token().
SimpleSAML\Auth\TimeLimitedToken::generate_token | ( | ) |
Definition at line 114 of file TimeLimitedToken.php.
References SimpleSAML\Auth\TimeLimitedToken\generate().
SimpleSAML\Auth\TimeLimitedToken::validate | ( | $token | ) |
Validates a token by calculating the token value for the provided offset and comparing it.
string | $token | The token to validate. |
Definition at line 127 of file TimeLimitedToken.php.
References SimpleSAML\Auth\TimeLimitedToken\calculateTokenValue().
Referenced by SimpleSAML\Auth\TimeLimitedToken\validate_token().
SimpleSAML\Auth\TimeLimitedToken::validate_token | ( | $token | ) |
Definition at line 143 of file TimeLimitedToken.php.
References SimpleSAML\Auth\TimeLimitedToken\validate().
|
protected |
Definition at line 29 of file TimeLimitedToken.php.
Referenced by SimpleSAML\Auth\TimeLimitedToken\__construct().
|
protected |
Definition at line 19 of file TimeLimitedToken.php.
Referenced by SimpleSAML\Auth\TimeLimitedToken\__construct().
|
protected |
Definition at line 14 of file TimeLimitedToken.php.
Referenced by SimpleSAML\Auth\TimeLimitedToken\__construct().
|
protected |
Definition at line 24 of file TimeLimitedToken.php.
Referenced by SimpleSAML\Auth\TimeLimitedToken\__construct(), and SimpleSAML\Auth\TimeLimitedToken\generate().