Ejemplo n.º 1
0
 function is_user_logged_in()
 {
     $user = wp_get_current_user();
     // Start session if not started already
     if (!isset($_SESSION)) {
         session_start();
     }
     $mnoSession = new Maestrano_Sso_Session($_SESSION);
     // Check user exists and maestrano session is still valid
     if (!$user->exists() || !$mnoSession->isValid()) {
         return false;
     }
     return true;
 }
Ejemplo n.º 2
0
 public function testIsValidWhenRecheckRequiredAndValidReturnsTrueAndSaveTheSession()
 {
     // Make sure any remote response is negative
     $date = new DateTime();
     $date->add(new DateInterval('PT100M'));
     $resp = array();
     $resp["valid"] = "true";
     $resp["recheck"] = $date->format(DateTime::ISO8601);
     $this->httpClient->setResponseStub($resp);
     // Set local recheck in the past
     $localRecheck = new DateTime();
     $localRecheck->sub(new DateInterval('PT1M'));
     $oldSubject = new Maestrano_Sso_Session($this->httpSession);
     $oldSubject->setRecheck($localRecheck);
     // test 1 - validity
     $this->assertTrue($oldSubject->isValid(false, $this->httpClient));
     // Create a new subject to test session persistence
     $this->subject = new Maestrano_Sso_Session($this->httpSession);
     // test 2 - session persistence
     $this->assertEquals($date->format(DateTime::ISO8601), $this->subject->getRecheck()->format(DateTime::ISO8601));
 }
Ejemplo n.º 3
0
<?php

if (!isset($_SESSION)) {
    session_start();
}
// Include Maestrano required libraries
require_once 'vendor/maestrano/maestrano-php/lib/Maestrano.php';
Maestrano::configure('maestrano.json');
// Check session validity and trigger SSO if not
if (Maestrano::sso()->isSsoEnabled()) {
    $mnoSession = new Maestrano_Sso_Session($_SESSION);
    if (!$mnoSession->isValid()) {
        $_SESSION['mno_previous_uri'] = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
        $req = new Maestrano_Saml_Request($_GET);
        header('Location: ' . $req->getRedirectUrl());
        exit;
    }
}
?>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>File Manager</title>
<link rel="stylesheet" type="text/css" href="styles/reset.css" />
<link rel="stylesheet" type="text/css" href="scripts/jquery.filetree/jqueryFileTree.css" />
<link rel="stylesheet" type="text/css" href="scripts/jquery.contextmenu/jquery.contextMenu-1.01.css" />
<link rel="stylesheet" type="text/css" href="scripts/custom-scrollbar-plugin/jquery.mCustomScrollbar.min.css" />
<style type="text/css">
	#loading-wrap {