[6351] | 1 | <?php |
---|
| 2 | |
---|
| 3 | /** |
---|
| 4 | * Storage engines that want to support refresh tokens should |
---|
| 5 | * 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-6 |
---|
| 9 | * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-1.5 |
---|
| 10 | */ |
---|
| 11 | interface IOAuth2RefreshTokens extends IOAuth2Storage { |
---|
| 12 | |
---|
| 13 | /** |
---|
| 14 | * Grant refresh access tokens. |
---|
| 15 | * |
---|
| 16 | * Retrieve the stored data for the given refresh token. |
---|
| 17 | * |
---|
| 18 | * Required for OAuth2::GRANT_TYPE_REFRESH_TOKEN. |
---|
| 19 | * |
---|
| 20 | * @param $refresh_token |
---|
| 21 | * Refresh token to be check with. |
---|
| 22 | * |
---|
| 23 | * @return |
---|
| 24 | * An associative array as below, and NULL if the refresh_token is |
---|
| 25 | * invalid: |
---|
| 26 | * - client_id: Stored client identifier. |
---|
| 27 | * - expires: Stored expiration unix timestamp. |
---|
| 28 | * - scope: (optional) Stored scope values in space-separated string. |
---|
| 29 | * |
---|
| 30 | * @see http://tools.ietf.org/html/draft-ietf-oauth-v2-20#section-6 |
---|
| 31 | * |
---|
| 32 | * @ingroup oauth2_section_6 |
---|
| 33 | */ |
---|
| 34 | public function getRefreshToken($refresh_token); |
---|
| 35 | |
---|
| 36 | /** |
---|
| 37 | * Take the provided refresh token values and store them somewhere. |
---|
| 38 | * |
---|
| 39 | * This function should be the storage counterpart to getRefreshToken(). |
---|
| 40 | * |
---|
| 41 | * If storage fails for some reason, we're not currently checking for |
---|
| 42 | * any sort of success/failure, so you should bail out of the script |
---|
| 43 | * and provide a descriptive fail message. |
---|
| 44 | * |
---|
| 45 | * Required for OAuth2::GRANT_TYPE_REFRESH_TOKEN. |
---|
| 46 | * |
---|
| 47 | * @param $refresh_token |
---|
| 48 | * Refresh token to be stored. |
---|
| 49 | * @param $client_id |
---|
| 50 | * Client identifier to be stored. |
---|
| 51 | * @param $expires |
---|
| 52 | * expires to be stored. |
---|
| 53 | * @param $scope |
---|
| 54 | * (optional) Scopes to be stored in space-separated string. |
---|
| 55 | * |
---|
| 56 | * @ingroup oauth2_section_6 |
---|
| 57 | */ |
---|
| 58 | public function setRefreshToken($refresh_token, $client_id, $user_id, $expires, $scope = NULL); |
---|
| 59 | |
---|
| 60 | /** |
---|
| 61 | * Expire a used refresh token. |
---|
| 62 | * |
---|
| 63 | * This is not explicitly required in the spec, but is almost implied. |
---|
| 64 | * After granting a new refresh token, the old one is no longer useful and |
---|
| 65 | * so should be forcibly expired in the data store so it can't be used again. |
---|
| 66 | * |
---|
| 67 | * If storage fails for some reason, we're not currently checking for |
---|
| 68 | * any sort of success/failure, so you should bail out of the script |
---|
| 69 | * and provide a descriptive fail message. |
---|
| 70 | * |
---|
| 71 | * @param $refresh_token |
---|
| 72 | * Refresh token to be expirse. |
---|
| 73 | * |
---|
| 74 | * @ingroup oauth2_section_6 |
---|
| 75 | */ |
---|
| 76 | public function unsetRefreshToken($refresh_token); |
---|
| 77 | } |
---|