Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a6f81f5

Browse files
author
Dave Rochwerger
committed
Moved global constants into class constants. Other minor refactoring.
1 parent a1728c6 commit a6f81f5

File tree

7 files changed

+579
-497
lines changed

7 files changed

+579
-497
lines changed

lib/IOAuth2Storage.php

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function setAccessToken($oauth_token, $client_id, $user_id, $expires, $sc
8484
*
8585
* Retrieve the stored data for the given authorization code.
8686
*
87-
* Required for OAUTH2_GRANT_TYPE_AUTH_CODE.
87+
* Required for OAuth2::GRANT_TYPE_AUTH_CODE.
8888
*
8989
* @param $code
9090
* Authorization code to be check with.
@@ -111,7 +111,7 @@ public function getAuthCode($code);
111111
* any sort of success/failure, so you should bail out of the script
112112
* and provide a descriptive fail message.
113113
*
114-
* Required for OAUTH2_GRANT_TYPE_AUTH_CODE.
114+
* Required for OAuth2::GRANT_TYPE_AUTH_CODE.
115115
*
116116
* @param $code
117117
* Authorization code to be stored.
@@ -135,7 +135,7 @@ public function setAuthCode($code, $client_id, $user_id, $redirect_uri, $expires
135135
*
136136
* Retrieve the stored data for the given refresh token.
137137
*
138-
* Required for OAUTH2_GRANT_TYPE_REFRESH_TOKEN.
138+
* Required for OAuth2::GRANT_TYPE_REFRESH_TOKEN.
139139
*
140140
* @param $refresh_token
141141
* Refresh token to be check with.
@@ -162,7 +162,7 @@ public function getRefreshToken($refresh_token);
162162
* any sort of success/failure, so you should bail out of the script
163163
* and provide a descriptive fail message.
164164
*
165-
* Required for OAUTH2_GRANT_TYPE_REFRESH_TOKEN.
165+
* Required for OAuth2::GRANT_TYPE_REFRESH_TOKEN.
166166
*
167167
* @param $refresh_token
168168
* Refresh token to be stored.
@@ -201,7 +201,7 @@ public function unsetRefreshToken($refresh_token);
201201
* Not really described in the IETF Draft, so I just left a method
202202
* stub... Do whatever you want!
203203
*
204-
* Required for OAUTH2_GRANT_TYPE_NONE.
204+
* Required for OAuth2::GRANT_TYPE_NONE.
205205
*
206206
* @ingroup oauth2_section_4
207207
*/
@@ -215,7 +215,7 @@ public function checkNoneAccess($client_id);
215215
* You can also use the $client_id param to do any checks required based
216216
* on a client, if you need that.
217217
*
218-
* Required for OAUTH2_GRANT_TYPE_ASSERTION.
218+
* Required for OAuth2::GRANT_TYPE_ASSERTION.
219219
*
220220
* @param $client_id
221221
* Client identifier to be check with.
@@ -250,7 +250,7 @@ public function checkAssertion($client_id, $assertion_type, $assertion);
250250
* You can also use the $client_id param to do any checks required based
251251
* on a client, if you need that.
252252
*
253-
* Required for OAUTH2_GRANT_TYPE_USER_CREDENTIALS.
253+
* Required for OAuth2::GRANT_TYPE_USER_CREDENTIALS.
254254
*
255255
* @param $client_id
256256
* Client identifier to be check with.
@@ -288,7 +288,7 @@ public function checkUserCredentials($client_id, $username, $password);
288288
* Client identifier to be check with.
289289
* @param $response_type
290290
* Authorization response type to be check with, would be one of the
291-
* values contained in OAUTH2_AUTH_RESPONSE_TYPE_REGEXP.
291+
* values contained in OAuth2::RESPONSE_TYPE_REGEXP.
292292
*
293293
* @return
294294
* TRUE if the authorization response type is supported by this
@@ -308,7 +308,7 @@ public function checkRestrictedAuthResponseType($client_id, $response_type);
308308
* Client identifier to be check with.
309309
* @param $grant_type
310310
* Grant type to be check with, would be one of the values contained in
311-
* OAUTH2_GRANT_TYPE_REGEXP.
311+
* OAuth2::GRANT_TYPE_REGEXP.
312312
*
313313
* @return
314314
* TRUE if the grant type is supported by this client identifier, and
@@ -319,8 +319,24 @@ public function checkRestrictedAuthResponseType($client_id, $response_type);
319319
public function checkRestrictedGrantType($client_id, $grant_type);
320320

321321
/**
322-
*
323-
* Enter description here ...
324-
*/
322+
* Return supported grant types.
323+
*
324+
* You should override this function with something, or else your OAuth
325+
* provider won't support any grant types!
326+
*
327+
* @return
328+
* A list as below. If you support all grant types, then you'd do:
329+
* @code
330+
* return array(
331+
* OAuth2::GRANT_TYPE_AUTH_CODE,
332+
* OAuth2::GRANT_TYPE_USER_CREDENTIALS,
333+
* OAuth2::GRANT_TYPE_ASSERTION,
334+
* OAuth2::GRANT_TYPE_REFRESH_TOKEN,
335+
* OAuth2::GRANT_TYPE_NONE,
336+
* );
337+
* @endcode
338+
*
339+
* @ingroup oauth2_section_4
340+
*/
325341
public function getSupportedGrantTypes();
326342
}

0 commit comments

Comments
 (0)