mirror of
				https://github.com/elyby/accounts.git
				synced 2025-05-31 14:11:46 +05:30 
			
		
		
		
	Extract encryption key into the configuration param
This commit is contained in:
		@@ -13,6 +13,11 @@ use yii\base\Component as BaseComponent;
 | 
			
		||||
 | 
			
		||||
class Component extends BaseComponent {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var string|\Defuse\Crypto\Key
 | 
			
		||||
     */
 | 
			
		||||
    public $encryptionKey;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * @var AuthorizationServer
 | 
			
		||||
     */
 | 
			
		||||
@@ -34,7 +39,7 @@ class Component extends BaseComponent {
 | 
			
		||||
                $accessTokensRepo,
 | 
			
		||||
                new Repositories\EmptyScopeRepository(),
 | 
			
		||||
                new EmptyKey(),
 | 
			
		||||
                '123' // TODO: extract to the variable
 | 
			
		||||
                $this->encryptionKey
 | 
			
		||||
            );
 | 
			
		||||
            $authCodeGrant = new AuthCodeGrant($authCodesRepo, $refreshTokensRepo, new DateInterval('PT10M'));
 | 
			
		||||
            $authCodeGrant->disableRequireCodeChallengeForPublicClients();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,9 @@
 | 
			
		||||
<?php
 | 
			
		||||
return [
 | 
			
		||||
    'components' => [
 | 
			
		||||
        'oauth' => [
 | 
			
		||||
            'encryptionKey' => 'mock-encryption-key',
 | 
			
		||||
        ],
 | 
			
		||||
        'tokens' => [
 | 
			
		||||
            'hmacKey' => 'tests-secret-key',
 | 
			
		||||
            'privateKeyPath' => codecept_data_dir('certs/private.pem'),
 | 
			
		||||
 
 | 
			
		||||
@@ -11,6 +11,10 @@ return [
 | 
			
		||||
        'user' => [
 | 
			
		||||
            'class' => api\components\User\Component::class,
 | 
			
		||||
        ],
 | 
			
		||||
        'oauth' => [
 | 
			
		||||
            'class' => api\components\OAuth2\Component::class,
 | 
			
		||||
            'encryptionKey' => getenv('JWT_ENCRYPTION_KEY'),
 | 
			
		||||
        ],
 | 
			
		||||
        'tokens' => [
 | 
			
		||||
            'class' => api\components\Tokens\Component::class,
 | 
			
		||||
            'hmacKey' => getenv('JWT_USER_SECRET'),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user