diff --git a/config/packages/league_oauth2_server.yaml b/config/packages/league_oauth2_server.yaml index 00f08ecf2c90673a0ff9147837a0eacc69c8c44b..c629d67d26ddfb9da3f9323929335859151705a1 100644 --- a/config/packages/league_oauth2_server.yaml +++ b/config/packages/league_oauth2_server.yaml @@ -3,7 +3,7 @@ league_oauth2_server: # Full path to the private key file. # How to generate a private key: https://oauth2.thephpleague.com/installation/#generating-public-and-private-keys - private_key: '%env(resolve:OAUTH_PRIVATE_KEY)%' + private_key: '%kernel.project_dir%%env(resolve:OAUTH_PRIVATE_KEY)%' # Passphrase of the private key, if any private_key_passphrase: '%env(OAUTH_PASSPHRASE)%' @@ -49,7 +49,7 @@ league_oauth2_server: # Full path to the public key file # How to generate a public key: https://oauth2.thephpleague.com/installation/#generating-public-and-private-keys - public_key: '%env(resolve:OAUTH_PUBLIC_KEY)%' + public_key: '%kernel.project_dir%%env(resolve:OAUTH_PUBLIC_KEY)%' scopes: # Scopes that you wish to utilize in your application. diff --git a/src/Controller/IndexController.php b/src/Controller/IndexController.php index c3d9541a1057599739c3810ca77d9c189f8a0368..2f8165f1d129d81a79e283f22b8ed0e8a20aed30 100644 --- a/src/Controller/IndexController.php +++ b/src/Controller/IndexController.php @@ -44,7 +44,7 @@ class IndexController extends AbstractController { // Load the public key from the filesystem and use OpenSSL to parse it. $kernelDirectory = $this->getParameter('kernel.project_dir'); - $publicKey = openssl_pkey_get_public(file_get_contents($kernelDirectory . '/var/keys/public.key')); + $publicKey = openssl_pkey_get_public(file_get_contents($kernelDirectory . $_ENV['OAUTH_PUBLIC_KEY'])); $details = openssl_pkey_get_details($publicKey); $jwks = [ 'keys' => [