PHP code example of uicosp / jwt-cas-client

1. Go to this page and download the library: Download uicosp/jwt-cas-client library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

uicosp / jwt-cas-client example snippets


array:6 [
  "sub" => 11
  "iss" => "http://user.dev/jwt/login"
  "iat" => 1482998888
  "exp" => 1483002488
  "nbf" => 1482998888
  "jti" => "e148091d51ece1fb1cf77cc14d317298"
]

/**
 * The application's route middleware.
 *
 * These middleware may be assigned to groups or used individually.
 *
 * @var array
 */
protected $routeMiddleware = [
    'auth' => \Illuminate\Auth\Middleware\Authenticate::class,
    'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
    ...
    // 将中间件添加到路由中间件,按需调用
    'auth.cas' => \Uicosp\JwtCasClient\Middleware\VerifyCasToken::class,
];

Route::get('/', function () {
    return view('welcome')->middleware('auth.cas');
});