This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request zendframework/zendframework#2087 from davidwindell…
…/patch-7 [Auth] Allow basic resolver to return AuthResult
- Loading branch information
28 parents
c14d5e7
+
78b260b
+
a6c654b
+
6dcb060
+
ba14e90
+
dc7d636
+
06375a2
+
53fdaa9
+
80ccc9b
+
fa80520
+
4009aca
+
ad280cb
+
b0d3db4
+
9b28224
+
49a871c
+
4145ab4
+
ff8e603
+
abd0527
+
9dc2f89
+
20317fc
+
da6fd5b
+
1702218
+
487a6e9
+
6051222
+
80b8984
+
a1a90b3
+
1d03186
+
f8038f7
commit a185b42
Showing
3 changed files
with
65 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Authentication | ||
*/ | ||
|
||
namespace ZendTest\Authentication\Adapter\Http\TestAsset; | ||
|
||
use Zend\Authentication\Result as AuthenticationResult; | ||
use Zend\Authentication\Adapter\Http\ResolverInterface; | ||
|
||
class BasicAuthObjectResolver implements ResolverInterface | ||
{ | ||
public function resolve($username, $realm, $password = null) | ||
{ | ||
if ($username == 'Bryce' && $password == 'ThisIsNotMyPassword') { | ||
$identity = new \stdClass(); | ||
|
||
return new AuthenticationResult( | ||
AuthenticationResult::SUCCESS, | ||
$identity, | ||
array('Authentication successful.') | ||
); | ||
} | ||
|
||
return new AuthenticationResult( | ||
AuthenticationResult::FAILURE, | ||
null, | ||
array('Authentication failed.') | ||
); | ||
} | ||
} |