getClient() static public method

Checks the authentication.
static public getClient ( String $username, $password ) : Model
$username String
return Model
コード例 #1
0
 /**
  * Constructs a new base controller.
  */
 public function __construct()
 {
     $this->lrs = Helpers::getLrsFromAuth();
     list($username, $password) = Helpers::getUserPassFromAuth();
     $this->client = Helpers::getClient($username, $password);
 }
コード例 #2
0
 /**
  * Gets the Lrs associated with the given username and password.
  * @param String $username
  * @param String $password
  * @return Lrs
  */
 static function getLrsFromUserPass($username, $password)
 {
     $client = Helpers::getClient($username, $password);
     $lrs = $client === null ? null : \Lrs::find($client->lrs_id);
     if ($lrs === null) {
         throw new Exceptions\Exception('Unauthorized request.', 401);
     }
     return $lrs;
 }