authserver/testCAS/app/Http/Controllers/WelcomeController.php
changeset 8 5a0cbbe0922a
parent 0 1afc9d2ab94d
equal deleted inserted replaced
7:1a3fa80225b2 8:5a0cbbe0922a
     1 <?php namespace TestCAS\Http\Controllers;
     1 <?php namespace TestCAS\Http\Controllers;
       
     2 
       
     3 use Log;
       
     4 use phpCAS;
     2 
     5 
     3 class WelcomeController extends Controller
     6 class WelcomeController extends Controller
     4 {
     7 {
     5     /*
     8     /*
     6     |--------------------------------------------------------------------------
     9     |--------------------------------------------------------------------------
    18      *
    21      *
    19      * @return void
    22      * @return void
    20      */
    23      */
    21     public function __construct()
    24     public function __construct()
    22     {
    25     {
       
    26         //$this->middleware('auth.cas');
       
    27     }
       
    28 
       
    29 
       
    30     public function storePGT()
       
    31     {
       
    32         Log::info("Connecting to callback page");
       
    33         Log::info($_GET);
       
    34 
       
    35         if (!empty($_GET['pgtIou'])&&!empty($_GET['pgtId'])) {
       
    36           phpCAS::traceBegin();
       
    37           $pgt_iou=$_GET["pgtIou"];
       
    38           $pgt=$_GET["pgtId"];
       
    39           $fname="/home/vagrant/Code/storage/PGT/".$pgt_iou.'.plain';
       
    40           if (!file_exists($fname)) {
       
    41               touch($fname);
       
    42               // Chmod will fail on windows
       
    43               @chmod($fname, 0600);
       
    44               if ($f=fopen($fname, "w")) {
       
    45                   if (fputs($f, $pgt) === false) {
       
    46                       phpCAS::error('could not write PGT to `'.$fname.'\'');
       
    47                   }
       
    48                   phpCAS::trace('Successful write of PGT to `'.$fname.'\'');
       
    49                   fclose($f);
       
    50               } else {
       
    51                   phpCAS::error('could not open `'.$fname.'\'');
       
    52               }
       
    53           } else {
       
    54               phpCAS::error('File exists: `'.$fname.'\'');
       
    55           }
       
    56           phpCAS::traceEnd();
       
    57         }
    23     }
    58     }
    24 
    59 
    25     /**
    60     /**
    26      * Show the application welcome screen to the user.
    61      * Show the application welcome screen to the user.
    27      *
    62      *
    28      * @return Response
    63      * @return Response
    29      */
    64      */
    30     public function index()
    65     public function index()
    31     {
    66     {
       
    67         Log::info("Connecting to index page");
    32         return view('welcome');
    68         return view('welcome');
    33     }
    69     }
       
    70 
    34 }
    71 }