klepak / nova-ad-auth
Laravel Nova AD Authentication with SSO in IIS
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:project
Requires
- adldap2/adldap2-laravel: ^6.0
- laravel/framework: 5.8.*
- laravel/nova: ~2.0
- spatie/laravel-permission: ^2.36
- vyuldashev/nova-permission: ^1.4
This package is auto-updated.
Last update: 2024-11-24 21:58:21 UTC
README
composer require nova-ad-auth
Add package provider after Nova provider in app.php
'providers' => [ ... App\Providers\NovaServiceProvider::class, Klepak\NovaAdAuth\AdAuthenticationServiceProvider::class, ];
Add to EventServiceProvider
use Adldap\Laravel\Events\AuthenticatedWithWindows; use Klepak\NovaAdAuth\Listeners\SynchronizeUserPermissions; use Klepak\NovaAdAuth\Listeners\SynchronizeUserThumbnail; ... protected $listen = [ ... AuthenticatedWithWindows::class => [ SynchronizeUserPermissions::class, SynchronizeUserThumbnail::class, ], ];
Add route middleware in Kernel.php
protected $routeMiddleware = [ ... 'auth.sso' => \Adldap\Laravel\Middleware\WindowsAuthenticate::class, 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class, 'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class, ];
Publish assets
php artisan vendor:publish --provider="Klepak\NovaAdAuth\AdAuthenticationServiceProvider" --force
NOTE: this will replace your existing auth and adldap config
Configure SSO
- Create a directory in your public folder called sso
- Copy your index.php to this directory, and add an additional ../ to all paths
- Create file called web.config in this directory, with following contents:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <security> <authentication> <windowsAuthentication enabled="true" /> <anonymousAuthentication enabled="false" /> </authentication> </security> <rewrite> <rules> <clear /> <rule name="Rewrite" enabled="true" stopProcessing="true"> <match url="^(?!storage)" ignoreCase="false" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" /> </conditions> <action type="Rewrite" url="index.php" appendQueryString="true" /> </rule> </rules> </rewrite> </system.webServer> </configuration>