parent
57337a6169
commit
37bef440be
@ -1,39 +0,0 @@ |
|||||||
<?php |
|
||||||
/* Written by Noel Dieschburg <noel@cblue.be> for the paris5 university |
|
||||||
|
|
||||||
* Checks if the user is already logged in via the cas system |
|
||||||
* Gets all the info via the ldap module (ldap has to work) |
|
||||||
|
|
||||||
*/ |
|
||||||
require_once api_get_path(SYS_PATH).'main/auth/cas/cas_var.inc.php'; |
|
||||||
|
|
||||||
/** |
|
||||||
* @return bool whether cas is configured |
|
||||||
*/ |
|
||||||
function cas_configured() |
|
||||||
{ |
|
||||||
foreach(['cas_server', 'cas_protocol', 'cas_port'] as $v) { |
|
||||||
if (is_null(api_get_setting($v))) { |
|
||||||
return false; |
|
||||||
} |
|
||||||
} |
|
||||||
return phpCAS::isInitialized(); |
|
||||||
} |
|
||||||
|
|
||||||
/* |
|
||||||
* Return the direct URL to a course code with CAS login |
|
||||||
*/ |
|
||||||
function get_cas_direct_URL($in_course_code) |
|
||||||
{ |
|
||||||
return api_get_path(WEB_PATH).'main/auth/cas/logincas.php?firstpage='.$in_course_code; |
|
||||||
} |
|
||||||
|
|
||||||
function getCASLogoHTML() |
|
||||||
{ |
|
||||||
$out_res = ""; |
|
||||||
if (api_get_setting("casLogoURL") != "") { |
|
||||||
$out_res = "<img src='".api_get_setting("casLogoURL")."' alt='CAS Logo' />"; |
|
||||||
} |
|
||||||
|
|
||||||
return $out_res; |
|
||||||
} |
|
@ -1,46 +0,0 @@ |
|||||||
<?php |
|
||||||
//---------------------------------------------------------------------- |
|
||||||
// CAS PLUGIN |
|
||||||
//---------------------------------------------------------------------- |
|
||||||
// Copyright (c) 2006-2007 University Marc Bloch (UMB) |
|
||||||
//---------------------------------------------------------------------- |
|
||||||
// This program is under the terms of the GENERAL PUBLIC LICENSE (GPL) |
|
||||||
// as published by the FREE SOFTWARE FOUNDATION. The GPL is available |
|
||||||
// through the world-wide-web at http://www.gnu.org/copyleft/gpl.html |
|
||||||
//---------------------------------------------------------------------- |
|
||||||
// Authors: Pierre Cahard |
|
||||||
//---------------------------------------------------------------------- |
|
||||||
// Load required |
|
||||||
require '../../inc/global.inc.php'; |
|
||||||
|
|
||||||
require_once 'authcas.php'; |
|
||||||
use ChamiloSession as Session; |
|
||||||
|
|
||||||
// phpCAS |
|
||||||
|
|
||||||
/* |
|
||||||
If we are not logged and in our browser enter an URL with a name of a course |
|
||||||
e.g. http://www.chamilo.fr/chamilo/courses/COURSTESTOSETE/?id_session=0 |
|
||||||
We go to page api_not_allowed : |
|
||||||
> You are not allowed to see this page. |
|
||||||
> Sorry, you are not allowed to access this page, or maybe your connection has expired. |
|
||||||
> Please click your browser's \"Back\" button or follow the link below to return to the previous page |
|
||||||
If we click on the link to go to homepage, some datas are entered in $_SESSION and if we enter our CAS login, |
|
||||||
we go to api_not_allowad_page again and again |
|
||||||
As a result, if we are not logged on, we have to destroy the session variables, before calling CAS page |
|
||||||
*/ |
|
||||||
if (api_is_anonymous()) { |
|
||||||
Session::destroy(); |
|
||||||
} |
|
||||||
|
|
||||||
if (cas_configured()) { |
|
||||||
$firstpage = ""; |
|
||||||
if (isset($_GET['firstpage'])) { |
|
||||||
$firstpage = $_GET['firstpage']; |
|
||||||
setcookie("GotoCourse", $firstpage); |
|
||||||
} |
|
||||||
phpCAS::forceAuthentication(); |
|
||||||
header('Location: '.api_get_path(WEB_PATH).api_get_setting('page_after_login')); |
|
||||||
} else { |
|
||||||
header('Location: '.api_get_path(WEB_PATH)); |
|
||||||
} |
|
@ -1,9 +0,0 @@ |
|||||||
<?php |
|
||||||
/* For licensing terms, see /license.txt */ |
|
||||||
/* |
|
||||||
Call this file to disconnect from CAS session. |
|
||||||
logoutWithUrl() not used because with CAS v3 you cannot redirect your logout to a specific URL |
|
||||||
because of security reason. |
|
||||||
*/ |
|
||||||
require '../..//inc/global.inc.php'; |
|
||||||
online_logout($_SESSION['_user']['user_id']); |
|
Loading…
Reference in new issue