diff --git a/src/Middleware/WindowsAuthenticate.php b/src/Middleware/WindowsAuthenticate.php index ad9ec366..810d3513 100644 --- a/src/Middleware/WindowsAuthenticate.php +++ b/src/Middleware/WindowsAuthenticate.php @@ -75,18 +75,18 @@ class WindowsAuthenticate public static $userDomainValidator = UserDomainValidator::class; /** - * The auth factory instance. + * The fallback callback to resolve users with. * - * @var Auth + * @var Closure|string|null */ - protected $auth; + public static $userResolverFallback; /** - * The fallback callback to resolve users with. + * The auth factory instance. * - * @var Closure|string|null + * @var Auth */ - protected static $fallback; + protected $auth; /** * Constructor. @@ -195,7 +195,7 @@ public static function validateDomainUsing($callback) */ public static function fallback($callback = null) { - static::$fallback = $callback; + static::$userResolverFallback = $callback; } /** @@ -452,11 +452,11 @@ protected function userIsApartOfDomain(Model $user, $username, $domain = null) */ protected function failedRetrievingUser(UserProvider $provider, $username, $domain = null) { - if (! static::$fallback) { + if (! static::$userResolverFallback) { return; } - return with(static::$fallback, function ($callback) { + return with(static::$userResolverFallback, function ($callback) { return is_string($callback) ? new $callback : $callback; })($provider, $username, $domain); } diff --git a/tests/Feature/WindowsAuthMiddlewareTest.php b/tests/Feature/WindowsAuthMiddlewareTest.php index 8d4aa8be..3f65c525 100644 --- a/tests/Feature/WindowsAuthMiddlewareTest.php +++ b/tests/Feature/WindowsAuthMiddlewareTest.php @@ -32,9 +32,9 @@ protected function tearDown(): void WindowsAuthenticate::$domainVerification = true; WindowsAuthenticate::$logoutUnauthenticatedUsers = false; WindowsAuthenticate::$rememberAuthenticatedUsers = false; + WindowsAuthenticate::$userResolverFallback = null; WindowsAuthenticate::$userDomainExtractor = null; WindowsAuthenticate::$userDomainValidator = UserDomainValidator::class; - WindowsAuthenticate::fallback(null); LdapRecord::$failingQuietly = true;