klepak / nova-ad-auth
关于此包最新版本(v1.0)没有提供许可证信息。
Laravel Nova AD 身份验证与 IIS 中的 SSO
v1.0
2019-03-30 19:50 UTC
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-09-24 21:42:38 UTC
README
composer require nova-ad-auth
在 app.php 中 Nova 提供商后添加包提供者
'providers' => [ ... App\Providers\NovaServiceProvider::class, Klepak\NovaAdAuth\AdAuthenticationServiceProvider::class, ];
添加到 EventServiceProvider
use Adldap\Laravel\Events\AuthenticatedWithWindows; use Klepak\NovaAdAuth\Listeners\SynchronizeUserPermissions; use Klepak\NovaAdAuth\Listeners\SynchronizeUserThumbnail; ... protected $listen = [ ... AuthenticatedWithWindows::class => [ SynchronizeUserPermissions::class, SynchronizeUserThumbnail::class, ], ];
在 Kernel.php 中添加路由中间件
protected $routeMiddleware = [ ... 'auth.sso' => \Adldap\Laravel\Middleware\WindowsAuthenticate::class, 'role' => \Spatie\Permission\Middlewares\RoleMiddleware::class, 'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class, ];
发布资产
php artisan vendor:publish --provider="Klepak\NovaAdAuth\AdAuthenticationServiceProvider" --force
注意:这将替换您现有的身份验证和 adldap 配置
配置 SSO
- 在您的公共文件夹中创建一个名为 sso 的目录
- 将您的 index.php 复制到该目录,并将所有路径的 ../ 更改为 ../
- 在此目录中创建名为 web.config 的文件,内容如下
<?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>