From 2ea99e047934e6185cae9210e6bc562bd35a2b1d Mon Sep 17 00:00:00 2001
From: Sonia Zorba <sonia.zorba@inaf.it>
Date: Mon, 1 Jul 2019 15:21:21 +0200
Subject: [PATCH] Moved auth/oauth2 -> auth/social

---
 auth/{oauth2 => social}/facebook_login.php | 0
 auth/{oauth2 => social}/facebook_token.php | 0
 auth/{oauth2 => social}/google_token.php   | 0
 auth/{oauth2 => social}/linkedin_login.php | 0
 auth/{oauth2 => social}/linkedin_token.php | 0
 config-example.php                         | 6 +++---
 include/admin.php                          | 2 ++
 include/front-controller.php               | 6 +++---
 8 files changed, 8 insertions(+), 6 deletions(-)
 rename auth/{oauth2 => social}/facebook_login.php (100%)
 rename auth/{oauth2 => social}/facebook_token.php (100%)
 rename auth/{oauth2 => social}/google_token.php (100%)
 rename auth/{oauth2 => social}/linkedin_login.php (100%)
 rename auth/{oauth2 => social}/linkedin_token.php (100%)

diff --git a/auth/oauth2/facebook_login.php b/auth/social/facebook_login.php
similarity index 100%
rename from auth/oauth2/facebook_login.php
rename to auth/social/facebook_login.php
diff --git a/auth/oauth2/facebook_token.php b/auth/social/facebook_token.php
similarity index 100%
rename from auth/oauth2/facebook_token.php
rename to auth/social/facebook_token.php
diff --git a/auth/oauth2/google_token.php b/auth/social/google_token.php
similarity index 100%
rename from auth/oauth2/google_token.php
rename to auth/social/google_token.php
diff --git a/auth/oauth2/linkedin_login.php b/auth/social/linkedin_login.php
similarity index 100%
rename from auth/oauth2/linkedin_login.php
rename to auth/social/linkedin_login.php
diff --git a/auth/oauth2/linkedin_token.php b/auth/social/linkedin_token.php
similarity index 100%
rename from auth/oauth2/linkedin_token.php
rename to auth/social/linkedin_token.php
diff --git a/config-example.php b/config-example.php
index 5c2fabc..49b10f7 100644
--- a/config-example.php
+++ b/config-example.php
@@ -59,16 +59,16 @@ $AUTHENTICATION_METHODS = array(
     'Google' => array(
         'id' => "XXXXXX",
         'secret' => "XXXXXX",
-        'callback' => $BASE_PATH . "/auth/oauth2/google_token.php"),
+        'callback' => $BASE_PATH . "/auth/social/google_token.php"),
     'Facebook' => array(
         'id' => "XXXXXX",
         'secret' => "XXXXXX",
         'version' => "v3.0",
-        'callback' => $BASE_PATH . "/auth/oauth2/facebook_token.php"),
+        'callback' => $BASE_PATH . "/auth/social/facebook_token.php"),
     'LinkedIn' => array(
         'id' => 'XXXXXX',
         'secret' => 'XXXXXX',
-        'callback' => $BASE_PATH . '/auth/oauth2/linkedin_token.php'
+        'callback' => $BASE_PATH . '/auth/social/linkedin_token.php'
     ),
     'X.509' => array(),
     'DirectIdP' => array(
diff --git a/include/admin.php b/include/admin.php
index 6423d34..4479012 100644
--- a/include/admin.php
+++ b/include/admin.php
@@ -19,6 +19,8 @@ function checkUser() {
 }
 
 Flight::route('GET /admin', function() {
+    checkUser();
+    
     global $VERSION;
     Flight::render('admin/index.php', array('title' => 'Admin panel',
             'version' => $VERSION));
diff --git a/include/front-controller.php b/include/front-controller.php
index 463ff21..5094c7d 100644
--- a/include/front-controller.php
+++ b/include/front-controller.php
@@ -54,15 +54,15 @@ function sendAuthRedirect($url) {
 }
 
 Flight::route('/google', function() {
-    sendAuthRedirect('/auth/oauth2/google_token.php');
+    sendAuthRedirect('/auth/social/google_token.php');
 });
 
 Flight::route('/facebook', function() {
-    sendAuthRedirect('/auth/oauth2/facebook_login.php');
+    sendAuthRedirect('/auth/social/facebook_login.php');
 });
 
 Flight::route('/linkedIn', function() {
-    sendAuthRedirect('/auth/oauth2/linkedin_login.php');
+    sendAuthRedirect('/auth/social/linkedin_login.php');
 });
 
 Flight::route('/eduGAIN', function() {
-- 
GitLab