authserver/testCAS/app/Http/Controllers/HomeController.php
author durandn
Fri, 09 Sep 2016 11:01:58 +0200
changeset 196 1b539c9480f9
parent 95 8ecee14c6d81
permissions -rw-r--r--
Imported mdplayer updates + Permalink on each comment (using AnnotationsList and Mediafragment) + view "iframe_hash" that forwards the hash to the iframe to test that the hash jump works properly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
<?php namespace TestCAS\Http\Controllers;
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
use Cas;
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 0
diff changeset
     4
use phpCAS;
0
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
class HomeController extends Controller {
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
    /*
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
    |--------------------------------------------------------------------------
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
    | Home Controller
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
    |--------------------------------------------------------------------------
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
    |
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
    | This controller renders your application's "dashboard" for users that
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
    | are authenticated. Of course, you are free to change or remove the
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
    | controller as you wish. It is just here to get your app started!
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
    |
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
    */
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
    /**
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
    * Create a new controller instance.
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
    *
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
    * @return void
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
    */
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
    public function __construct()
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
    {
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
        $this->middleware('auth.cas');
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
    }
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
    /**
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
    * Show the application dashboard to the user.
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
    *
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
    * @return Response
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
    */
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
    public function index()
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
    {
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 0
diff changeset
    36
        $pt="Error getting PT";
82
bf1c38268e25 Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
durandn
parents: 9
diff changeset
    37
        $pt=phpCAS::retrievePT(env("LDT_URL")."/remie/workunit/segments_single?project_id=".env("TEST_PROJECT_ID"), $err_code, $err_msg);
95
8ecee14c6d81 Updated Readme and homestead test app
durandn
parents: 82
diff changeset
    38
        $iframe_url=env("LDT_URL")."/remie/workunit/segments_single?project_id=".env("TEST_PROJECT_ID");
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 0
diff changeset
    39
9
3166a35f5f0d Added CAS Auth middleware and CAS Login urls to remie platform + removed authserver/homestead/.vagrant from repo
durandn
parents: 8
diff changeset
    40
        $loginUrl=env("LDT_URL")."/accounts/cas/login";
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 0
diff changeset
    41
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 0
diff changeset
    42
        return view('home')->with(
82
bf1c38268e25 Updated Readmes + Updated tmp CAS config + Updated Laravel test with iframe + remove X-Frame django middleware from middlewares + removed local ssl certificate from repo
durandn
parents: 9
diff changeset
    43
          array("pt" => $pt, "err_code" => $err_code, "err_msg" => $err_msg, "iframe_url" => $iframe_url, 'loginUrl' => $loginUrl)
8
5a0cbbe0922a CAS Authentication (normal and proxy) + local Homestead vm
durandn
parents: 0
diff changeset
    44
        );
0
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
    }
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
    /**
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
    * logout
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
    *
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
    * @return Response
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
    */
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
    public function logout()
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
    {
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
        cas::logout(['service'=>url('/')]);
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
        return redirect()->route('index');
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
    }
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
1afc9d2ab94d first commit of cas auth env
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
}