Ejemplo n.º 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();
 }
Ejemplo n.º 2
0
 /**
  *
  */
 public function testUsername()
 {
     $server = $this->getServerData();
     $request = new Request(['server' => $server]);
     $this->assertNull($request->username());
     //
     $server['PHP_AUTH_USER'] = '******';
     $request = new Request(['server' => $server]);
     $this->assertEquals('foobar', $request->username());
 }