PHP code example of edrisaturay / filament-azure-auth

1. Go to this page and download the library: Download edrisaturay/filament-azure-auth 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/ */

    

edrisaturay / filament-azure-auth example snippets


use EdrisaTuray\FilamentAzureAuth\AzureAuthPlugin;
use Filament\Panel;

public function panel(Panel $panel): Panel
{
    return $panel
        ->id('admin')
        ->path('admin')
        ->login()
        ->plugin(AzureAuthPlugin::make());
}

AzureAuthPlugin::make()
    ->domainAllowList(['iom.int']);

use App\Models\User;
use EdrisaTuray\FilamentAzureAuth\AzureAuthPlugin;
use EdrisaTuray\FilamentAzureAuth\EnsurePanelAccess;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Laravel\Socialite\Contracts\User as MicrosoftUser;

AzureAuthPlugin::make()
    ->createUserUsing(function (MicrosoftUser $oauthUser, AzureAuthPlugin $plugin): User {
        $user = new User;
        $user->forceFill([
            'name' => $oauthUser->getName() ?: $oauthUser->getEmail(),
            'email' => $oauthUser->getEmail(),
            'password' => Hash::make(Str::random(64)),
            // Add the application's 
bash
php artisan azure-auth:install --no-interaction
php artisan migrate --no-interaction
php artisan filament:assets --no-interaction
dotenv
AZURE_DEFAULT_ROLE=panel_user
bash
php artisan test --compact