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