From 41d7ba141f405dfa2f695546740ea049453de604 Mon Sep 17 00:00:00 2001 From: saravahdatipour Date: Tue, 3 Dec 2024 16:29:40 +0100 Subject: [PATCH 1/2] revert to use stored public key --- config.php | 18 +++++++++--------- get_session_request.php | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config.php b/config.php index 737b5c3..060016b 100644 --- a/config.php +++ b/config.php @@ -2,21 +2,21 @@ define('IRMA_SERVER_URL', getenv('IRMA_SERVER_URL') ?: 'http://localhost:8088'); define('API_TOKEN', getenv('API_TOKEN') ?: ''); -define('DEMO', false); -define('JWT_ENABLED', true); +define('DEMO', true); +define('JWT_ENABLED', getenv('JWT_ENABLED')?: false); if (DEMO) { define('ISSUER', 'irma-demo'); - define('BASE_URL', 'http://localhost'); - define('IRMATUBE_NEXT_SESSION_URL', BASE_URL . '/nl/get_session_request.php'); + define('BASE_URL', 'http://localhost:8080'); + define('IRMATUBE_NEXT_SESSION_URL', BASE_URL . '/get_session_request.php'); define('IRMATUBE_CREDENTIAL', 'irma-demo.IRMATube.member'); } else { - define('ISSUER', 'pbdf'); - define('BASE_URL', 'https://privacybydesign.foundation'); - define('IRMATUBE_NEXT_SESSION_URL', BASE_URL . '/demo/get_session_request.php'); - define('IRMATUBE_CREDENTIAL', 'pbdf.pbdf.irmatube'); + define('ISSUER',getenv('ISSUER') ?: 'pbdf'); + define('BASE_URL', getenv('BASE_URL') ?: 'https://privacybydesign.foundation'); + define('IRMATUBE_NEXT_SESSION_URL',getenv('IRMATUBE_NEXT_SESSION_URL') ?: BASE_URL . '/get_session_request.php'); + define('IRMATUBE_CREDENTIAL', getenv('IRMATUBE_CREDENTIAL') ?: 'pbdf.pbdf.irmatube'); } if (JWT_ENABLED) { - define('IRMA_SERVER_PUBLICKEY', __DIR__ . '/../data/pk.pem'); + define('IRMA_SERVER_PUBLICKEY',getenv('IRMA_SERVER_PUBLICKEY') ?: __DIR__ . '/../data/pk.pem'); } \ No newline at end of file diff --git a/get_session_request.php b/get_session_request.php index 4ba097b..616b4ea 100644 --- a/get_session_request.php +++ b/get_session_request.php @@ -8,7 +8,7 @@ function get_session_request($contents) { if (JWT_ENABLED) { - $jwt_pk = file_get_contents(IRMA_SERVER_URL . './publickey'); + $jwt_pk = file_get_contents(IRMA_SERVER_PUBLICKEY); try { $decoded = JWT::decode($contents, new Key($jwt_pk, 'RS256')); } catch (Exception $e) { From ebe06b998a73f688ae69ba484a70a5c0f0ff9ab4 Mon Sep 17 00:00:00 2001 From: saravahdatipour Date: Tue, 3 Dec 2024 16:53:35 +0100 Subject: [PATCH 2/2] small fix: demo to false --- config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.php b/config.php index 060016b..5608497 100644 --- a/config.php +++ b/config.php @@ -2,7 +2,7 @@ define('IRMA_SERVER_URL', getenv('IRMA_SERVER_URL') ?: 'http://localhost:8088'); define('API_TOKEN', getenv('API_TOKEN') ?: ''); -define('DEMO', true); +define('DEMO', false); define('JWT_ENABLED', getenv('JWT_ENABLED')?: false); if (DEMO) {