From 2f6553225ad5df9f3da5a21ce7a9cfe9ae322a09 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Thu, 15 Feb 2024 16:17:31 +0100 Subject: [PATCH] remove deprecated options and dependencies for dataporten/oauth --- .gitignore | 1 - dev.sh | 7 ------- dist/dataporten_config.php | 21 --------------------- flake.nix | 7 ------- inc/include.php | 3 --- lib/OAuth2-Client | 1 - www/paamelding/index.php | 19 ------------------- 7 files changed, 59 deletions(-) delete mode 100644 dist/dataporten_config.php delete mode 160000 lib/OAuth2-Client diff --git a/.gitignore b/.gitignore index f136e0d..0fbf257 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /sql_config.php -/dataporten_config.php *.sqlite /test.sql /vendor/ diff --git a/dev.sh b/dev.sh index 5569946..f1b4b06 100755 --- a/dev.sh +++ b/dev.sh @@ -4,15 +4,8 @@ which sqlite3 > /dev/null 2>&1 || (echo ERROR: sqlite not found; false) || exit test ! -e pvv.sqlite && sqlite3 pvv.sqlite < dist/pvv.sql test ! -e sql_config.php && cp -v dist/sql_config_example.php sql_config.php -test ! -e dataporten_config.php && cp -v dist/dataporten_config.php dataporten_config.php - test -e composer.phar || curl -O https://getcomposer.org/composer.phar -if test ! -f lib/OAuth2-Client/OAuth2Client.php ; then - echo Missing git submodules. Installing... - (set -x; git submodule update --init --recursive) || exit $? -fi - if test ! -d vendor; then php composer.phar install || exit $? cp -v dist/authsources_example.php vendor/simplesamlphp/simplesamlphp/config/authsources.php diff --git a/dist/dataporten_config.php b/dist/dataporten_config.php deleted file mode 100644 index dba9860..0000000 --- a/dist/dataporten_config.php +++ /dev/null @@ -1,21 +0,0 @@ - "", - 'client_secret' => "", - //'redirect_uri' => "https://pvv.ntnu.no/paamelding/", - 'redirect_uri' => "http://localhost:1080/paamelding/", - 'auth' => "https://auth.dataporten.no/oauth/authorization",#Authorization endpoint - 'token' => "https://auth.dataporten.no/oauth/token",#Token endpoint - - /* OPTIONAL */ - - # 'authorization_type' => "Bearer", - # 'session' => false, - # 'verify' => 1, - # 'grant_type' => "authorization_code", - # 'response_type' => "code", - # 'scope' => "", -]; diff --git a/flake.nix b/flake.nix index 0822929..54534e4 100644 --- a/flake.nix +++ b/flake.nix @@ -37,15 +37,8 @@ test -e pvv.sqlite || sqlite3 pvv.sqlite < dist/pvv.sql test -e sql_config.php || cp -v dist/sql_config_example.php sql_config.php - test -e dataporten_config.php || cp -v dist/dataporten_config.php dataporten_config.php - test -e composer.phar || curl -O https://getcomposer.org/composer.phar - if [ ! -f lib/OAuth2-Client/OAuth2Client.php ] ; then - echo Missing git submodules. Installing... - (set -x; git submodule update --init --recursive) || exit $? - fi - if [ ! -d vendor ] ; then php composer.phar install || exit $? cp -v dist/authsources_example.php vendor/simplesamlphp/simplesamlphp/config/authsources.php diff --git a/inc/include.php b/inc/include.php index 81185b7..ca66a67 100644 --- a/inc/include.php +++ b/inc/include.php @@ -5,9 +5,6 @@ require_once __DIR__ . DIRECTORY_SEPARATOR . 'agenda.php'; require_once __DIR__ . DIRECTORY_SEPARATOR . 'navbar.php'; -require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'lib', 'OAuth2-Client', 'OAuth2Client.php']); -require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'dataporten_config.php']); - require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'sql_config.php']); require_once dirname(__DIR__) . implode(DIRECTORY_SEPARATOR, ['', 'src', '_autoload.php']); diff --git a/lib/OAuth2-Client b/lib/OAuth2-Client deleted file mode 160000 index 7b2dc91..0000000 --- a/lib/OAuth2-Client +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7b2dc91100becd0c3d15de8764ad279ded0d3a58 diff --git a/www/paamelding/index.php b/www/paamelding/index.php index e4e43d3..a5a6688 100644 --- a/www/paamelding/index.php +++ b/www/paamelding/index.php @@ -5,25 +5,6 @@ session_start(); $attrs = $as->getAttributes(); -$oauth2 = new Kasperrt\Oauth2($dataportenConfig); - -if (isset($_GET['logout'])) { - session_destroy(); - header('Location: ' . $dataportenConfig["redirect_uri"]); - die(); -} -if (isset($_GET['login'])) { - $oauth2 -> redirect(); - die(); -} -if (isset($_GET['code'])) { - $token = $oauth2 -> get_access_token(htmlspecialchars($_GET['state']), htmlspecialchars($_GET['code'])); - $_SESSION['userdata'] = $oauth2 -> get_identity($token, 'https://auth.dataporten.no/userinfo'); - - header('Location: ' . $dataportenConfig["redirect_uri"]); - die(); -} - ?>