Skip to content

Commit 8846396

Browse files
committed
Adding some inline documentation
1 parent bc128ee commit 8846396

File tree

7 files changed

+90
-2
lines changed

7 files changed

+90
-2
lines changed

src/LucaDegasperi/OAuth2Server/Commands/ExpiredTokensCommand.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class ExpiredTokensCommand extends Command
2727
/**
2828
* Create a new command instance.
2929
*
30+
* @param SessionManagementInterface $sessions an implementation of the session management interface
3031
* @return void
3132
*/
3233
public function __construct(SessionManagementInterface $sessions)
@@ -74,6 +75,11 @@ protected function getOptions()
7475
);
7576
}
7677

78+
/**
79+
* Deletes the sessions with expired authorization and refresh tokens from the db
80+
*
81+
* @return int the number of sessions deleted
82+
*/
7783
protected function deleteExpiredTokens()
7884
{
7985
return $this->sessions->deleteExpired();

src/LucaDegasperi/OAuth2Server/Facades/AuthorizationServerFacade.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ class AuthorizationServerFacade extends Facade
66
{
77

88
/**
9+
* Get the registered name of the component
10+
*
11+
* @return string
912
* @codeCoverageIgnore
1013
*/
1114
protected static function getFacadeAccessor()

src/LucaDegasperi/OAuth2Server/Facades/ResourceServerFacade.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ class ResourceServerFacade extends Facade
66
{
77

88
/**
9+
* Get the registered name of the component
10+
*
11+
* @return string
912
* @codeCoverageIgnore
1013
*/
1114
protected static function getFacadeAccessor()

src/LucaDegasperi/OAuth2Server/Filters/CheckAuthorizationParamsFilter.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
class CheckAuthorizationParamsFilter
1010
{
1111

12+
/**
13+
* Run the check authorization params filter
14+
*
15+
* @param Route $route the route being called
16+
* @param Request $request the request object
17+
* @param string $scope additional filter arguments
18+
* @return Response|null a bad response in case the params are invalid
19+
*/
1220
public function filter($route, $request, $scope = null)
1321
{
1422
try {

src/LucaDegasperi/OAuth2Server/Filters/OAuthFilter.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
class OAuthFilter
88
{
99

10+
/**
11+
* Run the oauth filter
12+
*
13+
* @param Route $route the route being called
14+
* @param Request $request the request object
15+
* @param string $scope additional filter arguments
16+
* @return Response|null a bad response in case the request is invalid
17+
*/
1018
public function filter($route, $request, $scope = null)
1119
{
1220
try {

src/LucaDegasperi/OAuth2Server/Filters/OAuthOwnerFilter.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@
55

66
class OAuthOwnerFilter
77
{
8-
8+
/**
9+
* Run the oauth owner filter
10+
*
11+
* @param Route $route the route being called
12+
* @param Request $request the request object
13+
* @param string $scope the allowed owners (comma separated)
14+
* @return Response|null a bad response in case the owner is not authorized
15+
*/
916
public function filter($route, $request, $scope = null)
1017
{
1118
if (! is_null($scope) and ResourceServer::getOwnerType() !== $scope) {

src/LucaDegasperi/OAuth2Server/Proxies/AuthorizationServerProxy.php

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,29 @@
88

99
class AuthorizationServerProxy
1010
{
11-
11+
/**
12+
* The OAuth authorization server
13+
* @var [type]
14+
*/
1215
protected $authServer;
1316

17+
/**
18+
* Create a new AuthorizationServerProxy
19+
*
20+
* @param Authorization $authServer the OAuth Authorization Server to use
21+
*/
1422
public function __construct(Authorization $authServer)
1523
{
1624
$this->authServer = $authServer;
1725
}
1826

27+
/**
28+
* Pass the method call to the underlying Authorization Server
29+
*
30+
* @param string $method the method being called
31+
* @param array|null $args the arguments of the method being called
32+
* @return mixed the underlying method retuned value
33+
*/
1934
public function __call($method, $args)
2035
{
2136
switch (count($args)) {
@@ -34,11 +49,25 @@ public function __call($method, $args)
3449
}
3550
}
3651

52+
/**
53+
* Make a redirect to a client redirect URI
54+
* @param string $uri the uri to redirect to
55+
* @param array $params the query string parameters
56+
* @param string $queryDelimeter the query string delimiter
57+
* @return Redirect a Redirect object
58+
*/
3759
public function makeRedirect($uri, $params = array(), $queryDelimeter = '?')
3860
{
3961
return RedirectUri::make($uri, $params, $queryDelimeter);
4062
}
4163

64+
/**
65+
* Make a redirect with an authorization code
66+
*
67+
* @param string $code the authorization code of the redirection
68+
* @param array $params the redirection parameters
69+
* @return Redirect a Redirect object
70+
*/
4271
public function makeRedirectWithCode($code, $params = array())
4372
{
4473
return $this->makeRedirect($params['redirect_uri'], array(
@@ -47,6 +76,12 @@ public function makeRedirectWithCode($code, $params = array())
4776
));
4877
}
4978

79+
/**
80+
* Make a redirect with an error
81+
*
82+
* @param array $params the redirection parameters
83+
* @return Redirect a Redirect object
84+
*/
5085
public function makeRedirectWithError($params = array())
5186
{
5287
return $this->makeRedirect($params['redirect_uri'], array(
@@ -56,16 +91,34 @@ public function makeRedirectWithError($params = array())
5691
));
5792
}
5893

94+
/**
95+
* Check the authorization code request parameters
96+
*
97+
* @throws \OAuth2\Exception\ClientException
98+
* @return array Authorize request parameters
99+
*/
59100
public function checkAuthorizeParams()
60101
{
61102
return $this->authServer->getGrantType('authorization_code')->checkAuthoriseParams();
62103
}
63104

105+
/**
106+
* Authorize a new client
107+
* @param string $owner The owner type
108+
* @param string $owner_id The owner id
109+
* @param array $options Additional options to issue an authorization code
110+
* @return string An authorization code
111+
*/
64112
public function newAuthorizeRequest($owner, $owner_id, $options)
65113
{
66114
return $this->authServer->getGrantType('authorization_code')->newAuthoriseRequest($owner, $owner_id, $options);
67115
}
68116

117+
/**
118+
* Perform the access token flow
119+
*
120+
* @return Response the appropriate response object
121+
*/
69122
public function performAccessTokenFlow()
70123
{
71124
try {

0 commit comments

Comments
 (0)