-
Notifications
You must be signed in to change notification settings - Fork 0
/
AuthCodeInterface.php
50 lines (46 loc) · 1.25 KB
/
AuthCodeInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/**
* @package SugiPHP
* @subpackage OAuth2
* @author Plamen Popov <tzappa@gmail.com>
* @license http://opensource.org/licenses/mit-license.php (MIT License)
*/
namespace SugiPHP\OAuth2;
/**
* Implement this interface to use authorization codes.
* @see http://tools.ietf.org/html/rfc6749#section-1.3.1
*/
interface AuthCodeInterface extends TokenInterface
{
/**
* Saves authorization request code. Based on this code the client will ask for access token.
*
* @param string $code
* @param string $client_id
* @param mixed $user_id - the value passed in Server::grantAccess() method
* @param integer $expires
* @param string $redirect_uri
* @param string $scope
*/
function saveAuthCode($code, $client_id, $user_id, $expires, $redirect_uri, $scope);
/**
* Reads authorization code data from the storage.
* @see saveAuthCode()
*
* @param string $code
* @return array|NULL - An associative array:
* - user_id
* - client_id
* - expires
* - redirect_uri
* - scope
*/
function getAuthCode($code);
/**
* Fetches a token issued in exchange of the code
*
* @param string $code
* @return string|NULL - token issued or NULL if no token is issued based on the code
*/
function getTokenWithCode($code);
}