
DB refactoring Client Admin Rectoring upgraded layout to use latest bootstrap Added bower support Added Behat support OIDC Discovery suuport added OIDC JWKS endpoint added Refactored OpenId workflows Refactored OAuth2 workflows Server Keys Admin Added Authorization Code Flow refactored to support OIDC Allow native apps to use auth code grant Allow native apps to use "TokenEndpoint_AuthMethod_PrivateKeyJwt" Filter on UI public/private keys algs based on the key usage Set as default auth protocol for private clients "client_secret_basic" Added feature client_secret_expired Filtered content of Token Endpoint Authorization Signed Algorithm based on Token Endpoint Authorization Method Implemented OAuth 2.0 Multiple Response Type Encoding Practices Implemented OAuth 2.0 Form Post Response Mode Implicit Flow refactored to support OIDC UserInfo Endpoint (OIDC/Claims) Hybrid Flow OIDC Session Management Change-Id: If3d38666f3f7f56bd8c94b9df2e6340554512612
53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace oauth2\endpoints;
|
|
|
|
use oauth2\exceptions\InvalidGrantTypeException;
|
|
use oauth2\IOAuth2Protocol;
|
|
use oauth2\requests\OAuth2Request;
|
|
|
|
|
|
/**
|
|
* Class TokenEndpoint
|
|
* Token Endpoint Implementation
|
|
* The token endpoint is used by the client to obtain an access token by
|
|
* presenting its authorization grant or refresh token. The token
|
|
* endpoint is used with every authorization grant except for the
|
|
* implicit grant type (since an access token is issued directly).
|
|
* http://tools.ietf.org/html/rfc6749#section-3.2
|
|
* @package oauth2\endpoints
|
|
*/
|
|
class TokenEndpoint implements IOAuth2Endpoint
|
|
{
|
|
|
|
/**
|
|
* @var IOAuth2Protocol
|
|
*/
|
|
private $protocol;
|
|
|
|
/**
|
|
* @param IOAuth2Protocol $protocol
|
|
*/
|
|
public function __construct(IOAuth2Protocol $protocol)
|
|
{
|
|
$this->protocol = $protocol;
|
|
}
|
|
|
|
/**
|
|
* @param OAuth2Request $request
|
|
* @return mixed
|
|
* @throws InvalidGrantTypeException
|
|
*/
|
|
public function handle(OAuth2Request $request)
|
|
{
|
|
foreach ($this->protocol->getAvailableGrants() as $key => $grant) {
|
|
if ($grant->canHandle($request)) {
|
|
$request = $grant->buildTokenRequest($request);
|
|
if (is_null($request))
|
|
throw new InvalidGrantTypeException;
|
|
return $grant->completeFlow($request);
|
|
}
|
|
}
|
|
throw new InvalidGrantTypeException;
|
|
}
|
|
} |