This repository was archived by the owner on Jan 29, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed
Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -496,14 +496,19 @@ protected function _basicAuth($header)
496496 return $ this ->_challengeClient ();
497497 }
498498
499- $ password = $ this ->_basicResolver ->resolve ($ creds [0 ], $ this ->_realm );
500- if ($ password &&
501- $ this ->_secureStringCompare ($ password , $ creds [1 ])) {
499+ $ result = $ this ->_basicResolver ->resolve ($ creds [0 ], $ this ->_realm , $ creds [1 ]);
500+
501+ if ($ result
502+ && !is_array ($ result )
503+ && $ this ->_secureStringCompare ($ result , $ creds [1 ])
504+ ) {
502505 $ identity = array ('username ' =>$ creds [0 ], 'realm ' =>$ this ->_realm );
503506 return new Authentication \Result (Authentication \Result::SUCCESS , $ identity );
504- } else {
505- return $ this -> _challengeClient ( );
507+ } elseif ( is_array ( $ result )) {
508+ return new Authentication \ Result ( Authentication \Result:: SUCCESS , $ result );
506509 }
510+
511+ return $ this ->_challengeClient ();
507512 }
508513
509514 /**
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ public function getFile()
9999 * realm, false otherwise.
100100 * @throws Exception\ExceptionInterface
101101 */
102- public function resolve ($ username , $ realm )
102+ public function resolve ($ username , $ realm, $ password = null )
103103 {
104104 if (empty ($ username )) {
105105 throw new Exception \InvalidArgumentException ('Username is required ' );
Original file line number Diff line number Diff line change @@ -40,8 +40,9 @@ interface ResolverInterface
4040 *
4141 * @param string $username Username
4242 * @param string $realm Authentication Realm
43- * @return string|false User's shared secret, if the user is found in the
44- * realm, false otherwise.
43+ * @param string $password Password (optional)
44+ * @return string|array|false User's shared secret as string if found in realm, or User's identity as array
45+ * if resolved, false otherwise.
4546 */
46- public function resolve ($ username , $ realm );
47+ public function resolve ($ username , $ realm, $ password = null );
4748}
You can’t perform that action at this time.
0 commit comments