Cheetah
Public Member Functions | Public Attributes | List of all members
OAuth2\Storage\AuthorizationCodeInterface Interface Reference
Inheritance diagram for OAuth2\Storage\AuthorizationCodeInterface:
OAuth2\Storage\Cassandra OAuth2\Storage\CouchbaseDB OAuth2\Storage\DynamoDB OAuth2\Storage\Memory OAuth2\Storage\Mongo OAuth2\Storage\Pdo OAuth2\Storage\Redis

Public Member Functions

 getAuthorizationCode ($code)
 
 setAuthorizationCode ($code, $client_id, $user_id, $redirect_uri, $expires, $scope=null)
 
 expireAuthorizationCode ($code)
 

Public Attributes

const RESPONSE_TYPE_CODE = "code"
 

Detailed Description

Implement this interface to specify where the OAuth2 Server should get/save authorization codes for the "Authorization Code" grant type

Author
Brent Shaffer <bshafs at gmail dot com>

Definition at line 12 of file AuthorizationCodeInterface.php.

Member Function Documentation

◆ expireAuthorizationCode()

OAuth2\Storage\AuthorizationCodeInterface::expireAuthorizationCode (   $code)

once an Authorization Code is used, it must be exipired

See also
http://tools.ietf.org/html/rfc6749#section-4.1.2

The client MUST NOT use the authorization code more than once. If an authorization code is used more than once, the authorization server MUST deny the request and SHOULD revoke (when possible) all tokens previously issued based on that authorization code

Implemented in OAuth2\Storage\Redis, OAuth2\Storage\Pdo, OAuth2\Storage\Mongo, OAuth2\Storage\Memory, OAuth2\Storage\DynamoDB, OAuth2\Storage\CouchbaseDB, and OAuth2\Storage\Cassandra.

◆ getAuthorizationCode()

OAuth2\Storage\AuthorizationCodeInterface::getAuthorizationCode (   $code)

Fetch authorization code data (probably the most common grant type).

Retrieve the stored data for the given authorization code.

Required for OAuth2::GRANT_TYPE_AUTH_CODE.

Parameters
$codeAuthorization code to be check with.
Returns
An associative array as below, and NULL if the code is invalid
return array(
"client_id" => CLIENT_ID, // REQUIRED Stored client identifier
"user_id" => USER_ID, // REQUIRED Stored user identifier
"expires" => EXPIRES, // REQUIRED Stored expiration in unix timestamp
"redirect_uri" => REDIRECT_URI, // REQUIRED Stored redirect URI
"scope" => SCOPE, // OPTIONAL Stored scope values in space-separated string
);
See also
http://tools.ietf.org/html/rfc6749#section-4.1

Implemented in OAuth2\Storage\Redis, OAuth2\Storage\Pdo, OAuth2\Storage\Mongo, OAuth2\Storage\Memory, OAuth2\Storage\DynamoDB, OAuth2\Storage\CouchbaseDB, and OAuth2\Storage\Cassandra.

◆ setAuthorizationCode()

OAuth2\Storage\AuthorizationCodeInterface::setAuthorizationCode (   $code,
  $client_id,
  $user_id,
  $redirect_uri,
  $expires,
  $scope = null 
)

Take the provided authorization code values and store them somewhere.

This function should be the storage counterpart to getAuthCode().

If storage fails for some reason, we're not currently checking for any sort of success/failure, so you should bail out of the script and provide a descriptive fail message.

Required for OAuth2::GRANT_TYPE_AUTH_CODE.

Parameters
string$codeAuthorization code to be stored.
mixed$client_idClient identifier to be stored.
mixed$user_idUser identifier to be stored.
string$redirect_uriRedirect URI(s) to be stored in a space-separated string.
int$expiresExpiration to be stored as a Unix timestamp.
string$scopeOPTIONAL Scopes to be stored in space-separated string.

Member Data Documentation

◆ RESPONSE_TYPE_CODE

const OAuth2\Storage\AuthorizationCodeInterface::RESPONSE_TYPE_CODE = "code"

Definition at line 21 of file AuthorizationCodeInterface.php.


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