Свойство | Type | Description | |
---|---|---|---|
$conf | Array of persistent variables stored. | ||
$oldRefreshToken | string | Keep track of the old refresh token. So we can unset the old refresh tokens when a new one is issued. | |
$storage | oauth2\IOAuth2Storage | Storage engine for authentication server | |
$usedAuthCode | OAuth2\Model\IOAuth2AuthCode | Keep track of the used auth code. So we can mark it as used after successful authorization |
Méthode | Description | |
---|---|---|
__construct ( oauth2\IOAuth2Storage $storage, array $config = [] ) | Creates an OAuth2.0 server-side instance. | |
createAccessToken ( OAuth2\Model\IOAuth2Client $client, mixed $data, string | null $scope = null, integer | null $access_token_lifetime = null, boolean $issue_refresh_token = true, integer | null $refresh_token_lifetime = null ) : array | Handle the creation of access token, also issue refresh token if support. | |
finishClientAuthorization ( boolean $isAuthorized, mixed $data = null, |
Redirect the user appropriately after approval. | |
getBearerToken ( |
This is a convenience function that can be used to get the token, which can then be passed to verifyAccessToken(). The constraints specified by the draft are attempted to be adheared to in this method. | |
getVariable ( string $name, mixed $default = null ) : mixed | Returns a persistent variable. | |
grantAccessToken ( |
Grant or deny a requested access token. | |
setVariable ( string $name, mixed $value ) : |
Sets a persistent variable. | |
verifyAccessToken ( string $tokenParam, string $scope = null ) : OAuth2\Model\IOAuth2AccessToken | Check that a valid access token has been provided. |
Méthode | Description | |
---|---|---|
checkScope ( string $requiredScope, string $availableScope ) : boolean | Check if everything in required scope is contained in available scope. | |
genAccessToken ( ) : string | Generates an unique access token. | |
genAuthCode ( ) : string | Generates an unique auth code. | |
getAuthorizationHeader ( |
Pull out the Authorization HTTP header and return it. | |
getAuthorizeParams ( |
Pull the authorization request data out of the HTTP $request. | |
getBearerTokenFromFormEncodedBody ( |
Get the token from url encoded entity-body. | |
getBearerTokenFromHeaders ( |
Get the access token from the header | |
getBearerTokenFromQuery ( |
Get the token from the query string | |
getClientCredentials ( array $inputData, array $authHeaders ) : array | Internal function used to get the client credentials from HTTP basic auth or POST data. | |
getRedirectUri ( $redirectUri, OAuth2\Model\IOAuth2Client $client ) | ||
grantAccessTokenAuthCode ( OAuth2\Model\IOAuth2Client $client, array $input ) : array | ||
grantAccessTokenClientCredentials ( OAuth2\Model\IOAuth2Client $client, array $input, array $clientCredentials ) : array | boolean | ||
grantAccessTokenExtension ( OAuth2\Model\IOAuth2Client $client, array $inputData, array $authHeaders ) | ||
grantAccessTokenRefreshToken ( OAuth2\Model\IOAuth2Client $client, array $input ) : array | ||
grantAccessTokenUserCredentials ( OAuth2\Model\IOAuth2Client $client, array $input ) : array | boolean | ||
setDefaultOptions ( ) | Default configuration options are specified here. | |
validateRedirectUri ( string $inputUri, string | array $storedUris ) : boolean | Internal method for validating redirect URI supplied |
Méthode | Description | |
---|---|---|
buildUri ( string $uri, array $params ) : string | Build the absolute URI based on supplied URI and parameters. | |
createAuthCode ( OAuth2\Model\IOAuth2Client $client, mixed $data, string $redirectUri, string $scope = null ) : string | Handle the creation of auth code. | |
createRedirectUriCallbackResponse ( string $redirectUri, array $params ) : |
Returns redirect response | |
getJsonHeaders ( ) : array | Returns HTTP headers for JSON. |
public __construct ( oauth2\IOAuth2Storage $storage, array $config = [] ) | ||
$storage | oauth2\IOAuth2Storage | |
$config | array | An associative array as below of config options. See CONFIG_* constants. |
public createAccessToken ( OAuth2\Model\IOAuth2Client $client, mixed $data, string | null $scope = null, integer | null $access_token_lifetime = null, boolean $issue_refresh_token = true, integer | null $refresh_token_lifetime = null ) : array | ||
$client | OAuth2\Model\IOAuth2Client | |
$data | mixed | |
$scope | string | null | |
$access_token_lifetime | integer | null | How long the access token should live in seconds |
$issue_refresh_token | boolean | Issue a refresh tokeniIf true and the storage mechanism supports it |
$refresh_token_lifetime | integer | null | How long the refresh token should life in seconds |
Résultat | array |
public finishClientAuthorization ( boolean $isAuthorized, mixed $data = null, |
||
$isAuthorized | boolean | true or false depending on whether the user authorized the access. |
$data | mixed | Application data |
$request | ||
$scope | string | null | |
Résultat |
protected genAccessToken ( ) : string | ||
Résultat | string | An unique access token. |
protected genAuthCode ( ) : string | ||
Résultat | string | An unique auth code. |
protected getAuthorizationHeader ( |
||
$request | ||
Résultat | array | An array of the basic username and password provided. |
protected getAuthorizeParams ( |
||
$request | ||
Résultat | array |
protected getRedirectUri ( $redirectUri, OAuth2\Model\IOAuth2Client $client ) | ||
$client | OAuth2\Model\IOAuth2Client |
public grantAccessToken ( |
||
$request | (optional) The request | |
Résultat |
protected grantAccessTokenAuthCode ( OAuth2\Model\IOAuth2Client $client, array $input ) : array | ||
$client | OAuth2\Model\IOAuth2Client | |
$input | array | |
Résultat | array |
protected grantAccessTokenExtension ( OAuth2\Model\IOAuth2Client $client, array $inputData, array $authHeaders ) | ||
$client | OAuth2\Model\IOAuth2Client | |
$inputData | array | |
$authHeaders | array |
protected grantAccessTokenRefreshToken ( OAuth2\Model\IOAuth2Client $client, array $input ) : array | ||
$client | OAuth2\Model\IOAuth2Client | |
$input | array | |
Résultat | array |
protected setDefaultOptions ( ) |
public setVariable ( string $name, mixed $value ) : |
||
$name | string | The name of the variable to set. |
$value | mixed | The value to set. |
Résultat | The application (for chained calls of this method) |
public verifyAccessToken ( string $tokenParam, string $scope = null ) : OAuth2\Model\IOAuth2AccessToken | ||
$tokenParam | string | |
$scope | string | A space-separated string of required scope(s), if you want to check for scope. |
Résultat | OAuth2\Model\IOAuth2AccessToken | Token |
protected string $oldRefreshToken | ||
Résultat | string |
protected IOAuth2Storage,oauth2 $storage | ||
Résultat | oauth2\IOAuth2Storage |