-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[5.2] Add authenticate method to the guards (#13651)
* Make setUser fluent * Create AuthenticationException * Add authenticate method to the guards * Convert an AuthenticationException into an unauthenticated response
- Loading branch information
1 parent
4d4468e
commit 16def48
Showing
5 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Illuminate\Auth; | ||
|
||
use Exception; | ||
|
||
class AuthenticationException extends Exception | ||
{ | ||
/** | ||
* The guard instance. | ||
* | ||
* @var \Illuminate\Contracts\Auth\Guard | ||
*/ | ||
protected $guard; | ||
|
||
/** | ||
* Create a new authentication exception. | ||
* | ||
* @param \Illuminate\Contracts\Auth\Guard|null $guard | ||
*/ | ||
public function __construct($guard = null) | ||
{ | ||
$this->guard = $guard; | ||
|
||
parent::__construct('Unauthenticated.'); | ||
} | ||
|
||
/** | ||
* Get the guard instance. | ||
* | ||
* @return \Illuminate\Contracts\Auth\Guard|null | ||
*/ | ||
public function guard() | ||
{ | ||
return $this->guard; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters