PHP code example of lysice / laravel-sso

1. Go to this page and download the library: Download lysice/laravel-sso 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/ */

    

lysice / laravel-sso example snippets


'api' => [
    'bindings',
    \Illuminate\Session\Middleware\StartSession::class,
],

protected $middlewareGroups = [
        'web' => [
            ...
            \Lysice\LaravelSSO\Middleware\SSOAutoLogin::class,
        ],

        'api' => [
            ...
        ],
    ];

protected function attemptLogin(Request $request)
{
    $broker = new \Lysice\LaravelSSO\LaravelSSOBroker;
    
    $credentials = $this->credentials($request);
    return $broker->login($credentials[$this->username()], $credentials['password']);
}

public function logout(Request $request)
{
    $broker = new \Lysice\LaravelSSO\LaravelSSOBroker;
    
    $broker->logout();
    
    $this->guard()->logout();
    
    $request->session()->invalidate();
    
    return redirect('/');
}
shell
$ php artisan vendor:publish --provider="Lysice\LaravelSSO\SSOServiceProvider"
shell
$ php artisan migrate --path=vendor/Lysice/laravel-sso/database/migrations
shell
$ php artisan sso:broker:create {name}
shell
$ php artisan vendor:publish --provider="Lysice\LaravelSSO\SSOServiceProvider"

protected function attemptLogin(Request $request)
    {
        $broker = new LaravelSSOBroker();
        $credentials = $this->credentials($request);
		// this is your own field.
        $loginKey = $request->input('login_key', '');

        return $broker->handleLogin($credentials[$this->username()], $credentials['password'], $loginKey);
    }

protected function attemptLogin(Request $request)
    {
        $broker = new LaravelSSOBroker();
        $credentials = $this->credentials($request);
		// this is your own field. 
        $loginKey = $request->input('login_name', '');

        return $broker->handleLogin($credentials[$this->username()], $credentials['password'], $loginKey);
    }

$this->userInfo = $this->makeRequest('POST', 'loginMulti', [
            $key => $keyValue,
            'password' => $password,
            'key' => $key
        ]);