1. Go to this page and download the library: Download aerdes/laravel-samlite 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/ */
aerdes / laravel-samlite example snippets
namespace App\Http\Controllers;
use Aerdes\LaravelSamlite\Http\Controllers\SamlController;
use Aerdes\LaravelSamlite\SamlAuth;
class AuthenticationController extends SamlController
{
public function loginUser(SamlAuth $saml_auth)
{
$mail = $saml_auth->getAttribute('http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress')[0];
$name = $saml_auth->getAttribute('http://schemas.xmlsoap.org/ws/2005/05/identity/claims/displayname')[0];
$user = User::where('email', $mail)->first();
if (!$user) {
$user = new User;
$user->name = $name;
$user->email = $mail;
$user->password = md5(rand(1,10000));
$user->save();
}
$this->guard()->loginUsingId($user->id);
}
}