コード例 #1
0
 /**
  * Returns a basic authentication response if login is required and NULL if not.
  *
  * @access  public
  * @return  \mako\http\Response|null
  */
 public function basicAuth()
 {
     if ($this->isLoggedIn() || $this->login($this->request->username(), $this->request->password()) === true) {
         return;
     }
     return $this->basicHTTPAuthenticationResponse();
 }
コード例 #2
0
 /**
  *
  */
 public function testPassword()
 {
     $server = $this->getServerData();
     $request = new Request(['server' => $server]);
     $this->assertNull($request->password());
     //
     $server['PHP_AUTH_PW'] = 'foobar';
     $request = new Request(['server' => $server]);
     $this->assertEquals('foobar', $request->password());
 }