function logout() { session_destroy(); session_start(); $_SESSION['auth'] = array("logged" => False, "login_utc" => "", "cas_url" => Cas::getUrl()); return is_logged(); }
public function index() { // get signed in admin Cas::getCurrentUser(); $user = session('cas_user'); $response = file_get_contents('http://testserver.strathmore.edu:8082/dataservice/staff/getStaff/' . $user); $staffInformation = json_decode($response, true); $students = DB::table('students')->join('cleared_by', 'students.studentNo', '=', 'cleared_by.students_studentNo')->select('students.*', 'cleared_by.games_cleared_by')->where('cleared_by.games_cleared_by', '=', 'N/A')->paginate(10); return view('staff/games', compact('students', 'staffInformation', 'message')); }
public function index() { // get signed in admin Cas::getCurrentUser(); $user = session('cas_user'); $response = file_get_contents('http://testserver.strathmore.edu:8082/dataservice/staff/getStaff/' . $user); $staffInformation = json_decode($response, true); $message = "Please Attend to the following students Requesting to be cleared"; $students = DB::table('students')->join('charge', 'students.studentNo', '=', 'charge.students_studentNo')->join('cleared_by', 'students.studentNo', '=', 'cleared_by.students_studentNo')->select('students.*', 'cleared_by.finance_cleared_by')->where('cleared_by.finance_cleared_by', '=', 'N/A')->where('charge.queueFlag', '=', '6')->paginate(10); $pending = DB::table('students')->join('charge', 'students.studentNo', '=', 'charge.students_studentNo')->select('students.*', 'charge.*')->where('charge.total', '>', '0')->where('charge.queueFlag', '=', '7')->paginate(15); return view('staff/finance', compact('students', 'pending', 'staffInformation', 'message')); }
public function showWellcome() { if (Cas::isAuthenticated() == false) { Auth::logout(); return View::make('wellcome'); } if (Auth::check() == true) { $sgrUser = new sgrUser(Auth::user()); return Redirect::to($sgrUser->home()); } return View::make('wellcome'); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show() { Cas::getCurrentUser(); $user = session('cas_user'); $std = student::where('studentNo', '=', $user)->first(); $charge = charges::where('students_studentNo', '=', $user)->first(); $serial = Serial::where('students_studentNo', '=', $user)->first(); if ($charge->total == 0) { $html = PDF::make($std, $serial); } else { $html = PDF::create($std, $charge, $serial); } $mpdf = new mpdf(); $mpdf->WriteHTML($html); $mpdf->Output(); }
function register_login() { global $_CONFIG; // Déclaration de la variable étant globale session_destroy(); session_start(); if (!isset($_GET["ticket"])) { header('Location: ' . $_CONFIG['cas_url'] . 'login?service=' . $_CONFIG['service']); } else { $ticket = $_GET["ticket"]; $service = $_CONFIG['service']; $login = Cas::authenticate($ticket, $service); if ($login == -1) { $_SESSION['auth'] = array("logged" => False, "login_utc" => "", "cas_url" => Cas::getUrl()); echo $_CONFIG['cas_url'] . 'login?service=' . $_CONFIG['service']; } else { $_SESSION['auth'] = array("logged" => True, "login_utc" => $login, "cas_url" => Cas::getUrl()); } } }
/** * // logout sso | logout SGR */ public function doLogout() { if (Cas::isAuthenticated()) { Cas::logout(); } else { Auth::logout(); return View::make('wellcome'); } }
public function loginSso() { \Cas::authenticate(); $api = new ApiController(); $user = $api->_getUserAttributes(\Cas::getCurrentUser()); $_user = User::where('username', $user->username)->first(); if (!$_user) { $_user = new User(); $_user->email = $user->email; $_user->nip = $user->nip; $_user->username = $user->username; $_user->save(); } \Auth::login($_user); return redirect('/'); }
@extends('app') @section('content') {!! Form::model(new App\Video, array( 'route' => 'videos.store', 'class' => 'form-horizontal', 'novalidate' => 'novalidate', 'files' => true) ) !!} <?php $userRole = AuthHelper::authenticate(); $user = Cas::user(); ?> <!-- @include('videos/partials/_form', ['submit_text' => 'Upload']) --> <div class="hidden">{{AuthHelper::authenticate()}}</div> <div class = "container" style="padding:10px;"> <div class="row" style="padding:10px"> <div calss="col-xs-12" style="margin:auto;" > <div class="hidden" id="progress-box" style="max-width:100%;padding-left:0px; margin:auto; width:750px;"> <div class="panel-heading"><p id="panel-heading" class="text-muted">Loading.........</p></div> <center><div id="videoplayer" style="max-width:100%; height:auto; padding:10px;"> <div class="container-fluid" > <div class="progress"> <div class="progress-bar" id="progress-bar" style="width: 0%"></div> </div> </div></div></div></center> </div> </div>
$payutcClient = new AutoJsonClient($_CONFIG["payutc_server"], "WEBSALE"); $gingerClient = new GingerClient($_CONFIG["ginger_apikey"], $_CONFIG["ginger_server"]); $app->get('/', function () use($app, $gingerClient, $_CONFIG) { if (isset($_SESSION['username'])) { $userInfo = $gingerClient->getUser($_SESSION["username"]); $app->render('template.php', array("title" => $_CONFIG["title"], "loggedin" => true, "logoutUrl" => $_CONFIG["self_url"] . "logout", "userInfo" => $userInfo, "cotiseUrl" => $_CONFIG["self_url"] . "cotiser")); } else { $app->render('template.php', array("title" => $_CONFIG["title"], "loggedin" => false, "loginUrl" => $_CONFIG["self_url"] . "logincas")); } }); $app->get('/logincas', function () use($app, $payutcClient, $_CONFIG) { if (empty($_GET["ticket"])) { $casUrl = $payutcClient->getCasUrl() . "login?service=" . $_CONFIG["self_url"] . 'logincas'; $app->response->redirect($casUrl, 303); } else { $cas = new Cas($payutcClient->getCasUrl()); $user = $cas->authenticate($_GET["ticket"], $_CONFIG["self_url"] . 'logincas'); $_SESSION['username'] = $user; $app->response->redirect($_CONFIG["self_url"], 303); } }); $app->get('/logout', function () use($app, $_CONFIG, $payutcClient) { session_destroy(); $casUrl = $payutcClient->getCasUrl() . "logout?url=" . $_CONFIG["self_url"]; $app->response->redirect($casUrl, 303); }); $app->get('/cotiser', function () use($app, $gingerClient, $payutcClient, $_CONFIG) { $userInfo = $gingerClient->getUser($_SESSION["username"]); if (!$userInfo->is_cotisant) { $payutcClient->loginApp(array("key" => $_CONFIG["payutc_apikey"])); $vente = $payutcClient->createTransaction(array("items" => json_encode(array(array($_CONFIG["payutc_artid"], 1))), "fun_id" => $_CONFIG["payutc_funid"], "mail" => $userInfo->mail, "return_url" => $_CONFIG["self_url"], "callback_url" => $_CONFIG["self_url"] . "callback?username="******"username"]));
<?php Cas::logout();
}); App::after(function ($request, $response) { // }); /* |-------------------------------------------------------------------------- | Authentication Filters |-------------------------------------------------------------------------- | | The following filters are used to verify that the user of the current | session is logged into this application. The "basic" filter easily | integrates HTTP Basic authentication for quick, simple checking. | */ Route::filter('auth', function () { if (!Cas::isAuthenticated() || !Auth::check()) { if (Request::ajax()) { return Response::make('Necesitas iniciar sesión de nuevo. Por favor, recarga la página', 401); } else { return Redirect::to(route('wellcome')); } } }); //Comprueba si la petición se realizó por ajax Route::filter('ajax_check', function () { if (!Request::ajax()) { return Redirect::to(route('wellcome')); } }); //Comprobar si el usuario autentivcado tiene privilegios para realizar la acción requerida Route::filter('capacidad', function ($ruta, $peticion, $capacidad, $redirect) {
<?php if (!isset($_SESSION['user'])) { $cas = new Cas("https://cas.utc.fr/cas/", $accessPath); $user = $cas->authenticate(); if ($user == -1) { $cas->login(); } else { $user['user']; $_SESSION['user'] = $user['user']; include "modele/user/user.php"; if (!mexiste($user['user'])) { $nom = $user['nom']; $prenom = $user['prenom']; $mail = $user['mail']; mnouvel_user($user['user'], $nom, $prenom, $mail, ""); } unset($_GET['ticket']); $url = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; $url = strtok($url, '?'); header("Location: " . $url); } }
<?php require_once 'controleur/core/cas.php'; unset($_SESSION['user']); $cas = new Cas("https://cas.utc.fr/cas/", "http://localhost/trocecocup"); $cas->logout();