diff --git a/app/Domain/Auth/Actions/AuthenticateUserAction.php b/app/Domain/Auth/Actions/AuthenticateUserAction.php index e71b26f..3e9704a 100644 --- a/app/Domain/Auth/Actions/AuthenticateUserAction.php +++ b/app/Domain/Auth/Actions/AuthenticateUserAction.php @@ -70,14 +70,17 @@ public function execute(string $username, string $password) } } + // Use the username from the ccache to ensure we include the correct realm + $username = $ccache->getPrincipal(); + // Get the local user with this username (null if they don't exist) - $user = User::whereUsername($username . '@' . config('manager.realm'))->first(); + $user = User::whereUsername($username)->first(); // If the user doesn't exist then create them if (!$user) { $user = User::create( [ - 'username' => $username . '@' . config('manager.realm'), + 'username' => $username, ] ); }