-
-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
\Mezzio\Authentication\OAuth2\ConfigTrait::getPrivateKey() - does not accept array configuration for private key #47
Comments
Can we please get a test case, or code reference? I see that mezzio-authentication-oauth2/src/CryptKeyTrait.php Lines 14 to 17 in 05d2c0e
|
I have updated (and fixed) the BC report. |
/cc @arueckauer - we could expand the return type on the factory |
I've created a pull request, but I've just realised that is started from 2.5.x |
You can sign off last commit with For a test case it is required to set up the config array with an array value for the private key. Something like the following should work (I have not tested it) in public function testGetPrivateKeyReturnsArray()
{
$trait = new class {
use ConfigTrait;
/**
* @return array|string
*/
public function proxy(string $name, ContainerInterface $container)
{
return $this->$name($container);
}
};
$config = [
'authentication' => [
'private_key' => ['xxx', 'yyy'],
],
];
$container = $this->prophesize(ContainerInterface::class);
$container
->get('config')
->willReturn($config);
$result = $trait->proxy('getPrivateKey', $container->reveal());
$this->assertEquals($config['authentication']['private_key'], $result);
} |
I've pushed changes to the Thanks for the help. |
Do I need to fix the SignOff issue on all of the commits ? |
Handled in #48 |
BC Break Report
Return type declaration for
\Mezzio\Authentication\OAuth2\ConfigTrait::getPrivateKey():string
is not allowing array configurations anymore. This removes the possibility of configuring a private key with passphrase.Code reference: https://github.com/mezzio/mezzio-authentication-oauth2/blob/2.4.0/src/ConfigTrait.php#L14
Summary
Return type declaration for
\Mezzio\Authentication\OAuth2\ConfigTrait::getPrivateKey()
is not allowing array configurations anymore.Code reference: https://github.com/mezzio/mezzio-authentication-oauth2/blob/2.4.0/src/ConfigTrait.php#L14
This trait is used in
\Mezzio\Authentication\OAuth2\AuthorizationServerFactory:34
$privateKey = $this->getCryptKey($this->getPrivateKey($container), 'authentication.private_key');
So, even though
\Mezzio\Authentication\OAuth2\CryptKeyTrait::getCryptKey()
can accept as argumentstring|array $keyConfig
, because of the type hintingprotected function getPrivateKey(ContainerInterface $container): string
, array cannot be loaded anymore from container config.Previous behavior
\Mezzio\Authentication\OAuth2\ConfigTrait::getPrivateKey()
did NOT forcestring
as return type.Was allowing also
array
to be used in containerconfig
.Note: The array could contain the following keys
key_or_path
(mandatory),pass_phrase
(optional) ,key_permissions_check
(optional)https://github.com/mezzio/mezzio-authentication-oauth2/blob/2.4.0/src/CryptKeyTrait.php#L23
Current behavior
\Mezzio\Authentication\OAuth2\ConfigTrait::getPrivateKey(): string`
How to reproduce
\Mezzio\Authentication\OAuth2\CryptKeyTrait::getCryptKey - has explicit
string
andarray
in PHPDocCommit reference that introduced restriction:
e34d9e8
The text was updated successfully, but these errors were encountered: