Gets the Client/Lrs username and password from the OAuth authorization string.
static public getUserPassFromOAuth ( String $authorization ) : [String] | ||
$authorization | String | |
return | [String] |
/** * Gets the username and password from the authorization string. * @return [String] Formed of [Username, Password] */ static function getUserPassFromAuth() { $authorization = \LockerRequest::header('Authorization'); if ($authorization !== null && strpos($authorization, 'Basic') === 0) { list($username, $password) = Helpers::getUserPassFromBAuth($authorization); } else { if ($authorization !== null && strpos($authorization, 'Bearer') === 0) { list($username, $password) = Helpers::getUserPassFromOAuth($authorization); } else { throw new Exceptions\Exception('Invalid auth', 400); } } return [$username, $password]; }