Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.3] Add given guards to AuthenticationException #15745

Merged
merged 2 commits into from
Oct 4, 2016
Merged

[5.3] Add given guards to AuthenticationException #15745

merged 2 commits into from
Oct 4, 2016

Conversation

hiendv
Copy link
Contributor

@hiendv hiendv commented Oct 4, 2016

This is the default handler for AuthenticationException in laravel/laravel

    protected function unauthenticated($request, AuthenticationException $exception)
    {
        if ($request->expectsJson()) {
            return response()->json(['error' => 'Unauthenticated.'], 401);
        }

        return redirect()->guest('login');
    }

Currently, there is no way to determine which guards are given when the exception is thrown. The PR add a setter / getter of guards to AuthenticationException.

@taylorotwell taylorotwell merged commit 8543ea7 into laravel:5.3 Oct 4, 2016
@hiendv hiendv deleted the fix-authentication-exception branch October 4, 2016 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants