iwannamaybe/phpcas

PhpCas client for the Laravel Framework

1.0.14 2021-03-26 10:03 UTC

This package is auto-updated.

Last update: 2024-04-26 17:03:51 UTC


README

Build Status License

About Laravel

PhpCas client for the Laravel Framework 5.5.

Author

Yanghaiquan

Usage

create auth middleware then set the handle method like this:

/**
 * Handle an incoming request.
 *
 * @param  Request $request
 * @param  Closure $next
 * @return mixed
 */
public function handle(Request $request, Closure $next)
{
    PhpCas::handLogoutRequest();
    return PhpCas::checkAuthentication($request,$next,function ($userId){
	    $user = User::firstOrNew(['mobile' => $userId],['password' => bcrypt(123456)]);
	    return Auth::loginUsingId($user->id);
    });
}

License

The Laravel framework is open-sourced software licensed under the MIT license.