1 | <?php |
---|
2 | |
---|
3 | /** |
---|
4 | * Storage engines that support the "Authorization Code" |
---|
5 | * grant type should implement this interface |
---|
6 | * |
---|
7 | * @author Dave Rochwerger <catch.dave@gmail.com> |
---|
8 | * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-4.1 |
---|
9 | */ |
---|
10 | interface IOAuth2GrantCode extends IOAuth2Storage { |
---|
11 | |
---|
12 | /** |
---|
13 | * The Authorization Code grant type supports a response type of "code". |
---|
14 | * |
---|
15 | * @var string |
---|
16 | * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-1.4.1 |
---|
17 | * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-4.2 |
---|
18 | */ |
---|
19 | const RESPONSE_TYPE_CODE = OAuth2::RESPONSE_TYPE_AUTH_CODE; |
---|
20 | |
---|
21 | /** |
---|
22 | * Fetch authorization code data (probably the most common grant type). |
---|
23 | * |
---|
24 | * Retrieve the stored data for the given authorization code. |
---|
25 | * |
---|
26 | * Required for OAuth2::GRANT_TYPE_AUTH_CODE. |
---|
27 | * |
---|
28 | * @param $code |
---|
29 | * Authorization code to be check with. |
---|
30 | * |
---|
31 | * @return |
---|
32 | * An associative array as below, and NULL if the code is invalid: |
---|
33 | * - client_id: Stored client identifier. |
---|
34 | * - redirect_uri: Stored redirect URI. |
---|
35 | * - expires: Stored expiration in unix timestamp. |
---|
36 | * - scope: (optional) Stored scope values in space-separated string. |
---|
37 | * |
---|
38 | * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-4.1 |
---|
39 | * |
---|
40 | * @ingroup oauth2_section_4 |
---|
41 | */ |
---|
42 | public function getAuthCode($code); |
---|
43 | |
---|
44 | /** |
---|
45 | * Take the provided authorization code values and store them somewhere. |
---|
46 | * |
---|
47 | * This function should be the storage counterpart to getAuthCode(). |
---|
48 | * |
---|
49 | * If storage fails for some reason, we're not currently checking for |
---|
50 | * any sort of success/failure, so you should bail out of the script |
---|
51 | * and provide a descriptive fail message. |
---|
52 | * |
---|
53 | * Required for OAuth2::GRANT_TYPE_AUTH_CODE. |
---|
54 | * |
---|
55 | * @param $code |
---|
56 | * Authorization code to be stored. |
---|
57 | * @param $client_id |
---|
58 | * Client identifier to be stored. |
---|
59 | * @param $user_id |
---|
60 | * User identifier to be stored. |
---|
61 | * @param $redirect_uri |
---|
62 | * Redirect URI to be stored. |
---|
63 | * @param $expires |
---|
64 | * Expiration to be stored. |
---|
65 | * @param $scope |
---|
66 | * (optional) Scopes to be stored in space-separated string. |
---|
67 | * |
---|
68 | * @ingroup oauth2_section_4 |
---|
69 | */ |
---|
70 | public function setAuthCode($code, $client_id, $user_id, $redirect_uri, $expires, $scope = NULL); |
---|
71 | |
---|
72 | } |
---|