mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-23 05:29:52 +05:30
Encryption key is now always required so remove redundent code
This commit is contained in:
parent
850793ab88
commit
72349ef22f
@ -26,8 +26,6 @@ class AuthorizationServer implements EmitterAwareInterface
|
|||||||
{
|
{
|
||||||
use EmitterAwareTrait;
|
use EmitterAwareTrait;
|
||||||
|
|
||||||
const ENCRYPTION_KEY_ERROR = 'You must set the encryption key going forward to improve the security of this library - see this page for more information https://oauth2.thephpleague.com/v5-security-improvements/';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var GrantTypeInterface[]
|
* @var GrantTypeInterface[]
|
||||||
*/
|
*/
|
||||||
@ -108,16 +106,6 @@ class AuthorizationServer implements EmitterAwareInterface
|
|||||||
$this->responseType = $responseType;
|
$this->responseType = $responseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the encryption key
|
|
||||||
*
|
|
||||||
* @param string $key
|
|
||||||
*/
|
|
||||||
public function setEncryptionKey($key)
|
|
||||||
{
|
|
||||||
$this->encryptionKey = $key;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable a grant type on the server.
|
* Enable a grant type on the server.
|
||||||
*
|
*
|
||||||
@ -136,12 +124,6 @@ class AuthorizationServer implements EmitterAwareInterface
|
|||||||
$grantType->setPrivateKey($this->privateKey);
|
$grantType->setPrivateKey($this->privateKey);
|
||||||
$grantType->setPublicKey($this->publicKey);
|
$grantType->setPublicKey($this->publicKey);
|
||||||
$grantType->setEmitter($this->getEmitter());
|
$grantType->setEmitter($this->getEmitter());
|
||||||
|
|
||||||
if ($this->encryptionKey === null) {
|
|
||||||
// @codeCoverageIgnoreStart
|
|
||||||
error_log(self::ENCRYPTION_KEY_ERROR);
|
|
||||||
// @codeCoverageIgnoreEnd
|
|
||||||
}
|
|
||||||
$grantType->setEncryptionKey($this->encryptionKey);
|
$grantType->setEncryptionKey($this->encryptionKey);
|
||||||
|
|
||||||
$this->enabledGrantTypes[$grantType->getIdentifier()] = $grantType;
|
$this->enabledGrantTypes[$grantType->getIdentifier()] = $grantType;
|
||||||
@ -159,12 +141,6 @@ class AuthorizationServer implements EmitterAwareInterface
|
|||||||
*/
|
*/
|
||||||
public function validateAuthorizationRequest(ServerRequestInterface $request)
|
public function validateAuthorizationRequest(ServerRequestInterface $request)
|
||||||
{
|
{
|
||||||
if ($this->encryptionKey === null) {
|
|
||||||
// @codeCoverageIgnoreStart
|
|
||||||
error_log(self::ENCRYPTION_KEY_ERROR);
|
|
||||||
// @codeCoverageIgnoreEnd
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($this->enabledGrantTypes as $grantType) {
|
foreach ($this->enabledGrantTypes as $grantType) {
|
||||||
if ($grantType->canRespondToAuthorizationRequest($request)) {
|
if ($grantType->canRespondToAuthorizationRequest($request)) {
|
||||||
return $grantType->validateAuthorizationRequest($request);
|
return $grantType->validateAuthorizationRequest($request);
|
||||||
|
Loading…
Reference in New Issue
Block a user