PHP code example of quadcompanies / quadsso

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

    

quadcompanies / quadsso example snippets


DB::table('sessions')->where('user_id', $user->id)->delete();

'authentik' => [
    'client_id'     => env('AUTHENTIK_CLIENT_ID'),
    'client_secret' => env('AUTHENTIK_CLIENT_SECRET'),
    'redirect'      => env('AUTHENTIK_REDIRECT_URI', env('APP_URL') . '/auth/sso/callback'),
    'base_url'      => env('AUTHENTIK_BASE_URL'),
],

protected $fillable = [
    'name',
    'email',
    'password',
    'scim_external_id',
    'email_verified_at',
    'status',
    'level',
];

'disable_local_auth' => [
    'route_names' => ['register', 'register.store', 'password.request',
                      'password.email', 'password.reset', 'password.store',
                      'password.update'],
    'paths' => ['register', 'register/*', 'password/*',
                'forgot-password', 'reset-password', 'reset-password/*'],
],

// in your User model — the local password can never satisfy a check
public function getAuthPassword() { return null; }

namespace App\Sso;

use Illuminate\Database\Eloquent\Model;
use QuadCompanies\QuadSSO\Support\NullUserLifecycleHooks;

class OffboardingHooks extends NullUserLifecycleHooks
{
    public function __construct(private BillingClient $billing) {}

    public function beforeDelete(Model $user): void
    {
        if ($this->billing->hasOpenInvoices($user)) {
            throw new \RuntimeException('user has open invoices');   // vetoes the request
        }

        $this->billing->closeAccount($user);
    }

    public function afterDelete(Model $user): void
    {
        Log::info('offboarded', ['email' => $user->email]);
    }
}

'quadsso' => [
    'driver' => 'daily',
    'path' => storage_path('logs/quadsso.log'),
    'level' => 'debug',
    'days' => 14,
],

'field_mappings' => [
    'email' => 'email',
    'external_id' => 'scim_external_id',
    'email_verified_at' => 'email_verified_at',
    'name' => 'name',
    'name_first' => null,
    'name_last' => null,
    'name_middle' => null,
    'phone_cell' => null,
    'email_secondary' => null,
],

'field_mappings' => [
    // ...
    'name' => null,               // was 'name'
    'name_first' => 'name_first',  // was null
    'name_last' => 'name_last',    // was null
],

'provisioning' => [
    'user_status_field'    => 'account_status',
    'blocked_status_value' => 'disabled',
],

'user_model' => \App\Models\CustomUser::class,
bash
composer vendor:publish --tag=quadsso-config
php artisan migrate
bash
php artisan session:table   # only if you don't already have one
php artisan migrate
bash
php artisan tinker --execute="echo \Illuminate\Support\Str::random(64);"
bash
php artisan migrate      # adds users.quadsso_sessions_valid_after
bash
php artisan quadsso:doctor
bash
php artisan vendor:publish --tag=quadsso-migrations
js
export default {
    content: [
        './resources/**/*.blade.php',
        './vendor/quadcompanies/quadsso/resources/views/**/*.blade.php',
    ],
};
bash
php artisan vendor:publish --tag=quadsso-views