remove deprecated options and dependencies for dataporten/oauth

This commit is contained in:
Felix Albrigtsen 2024-02-15 16:17:31 +01:00 committed by Felix Albrigtsen
parent 1eb84eaec8
commit 2f6553225a
7 changed files with 0 additions and 59 deletions

1
.gitignore vendored
View File

@ -1,5 +1,4 @@
/sql_config.php
/dataporten_config.php
*.sqlite
/test.sql
/vendor/

7
dev.sh
View File

@ -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

View File

@ -1,21 +0,0 @@
<?php
# go to https://auth.dataporten.no/
$dataportenConfig = [
'client_id' => "",
'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' => "",
];

View File

@ -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

View File

@ -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']);

@ -1 +0,0 @@
Subproject commit 7b2dc91100becd0c3d15de8764ad279ded0d3a58

View File

@ -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();
}
?>
<!DOCTYPE html>
<html lang="no">