ValidateOAuth2Info() защищенный Метод

Validates that the OAuth2 info is complete.
protected ValidateOAuth2Info ( )
Пример #1
0
 /**
  * Validates the user and throws a validation error if there are any errors.
  * @throws ValidationException if there are any validation errors
  * @access private
  */
 private function ValidateUser()
 {
     if ($this->GetOAuthInfo() != NULL) {
         parent::ValidateOAuthInfo();
     } else {
         if ($this->GetOAuth2Info() != NULL) {
             parent::ValidateOAuth2Info();
         } else {
             if ($this->GetAuthToken() == NULL) {
                 if (!isset($this->email)) {
                     throw new ValidationException('email', NULL, 'email is required and cannot be NULL.');
                 }
                 if (!isset($this->password)) {
                     throw new ValidationException('password', NULL, 'password is required and cannot be NULL.');
                 }
                 // Generate an authToken.
                 $this->RegenerateAuthToken();
             }
         }
     }
     if ($this->GetApplicationName() == NULL) {
         throw new ValidationException('applicationName', NULL, 'applicationName is required and cannot be NULL.');
     }
 }
 /**
  * Validates the user and throws a validation error if there are any errors.
  * @throws ValidationException if there are any validation errors
  */
 public function ValidateUser()
 {
     if ($this->GetOAuth2Info() === null) {
         throw new ValidationException('OAuth2Info', null, 'OAuth 2.0 configuration is required.');
     }
     parent::ValidateOAuth2Info();
     if ($this->GetUserAgent() === null || trim($this->GetUserAgent()) === '' || strpos($this->GetUserAgent(), self::DEFAULT_USER_AGENT) !== false) {
         throw new ValidationException('userAgent', null, sprintf("The property userAgent is required and cannot be " . "null, the empty string, or the default [%s]", self::DEFAULT_USER_AGENT));
     }
     if ($this->GetDeveloperToken() === null) {
         throw new ValidationException('developerToken', null, 'developerToken is required and cannot be null.');
     }
 }
Пример #3
0
 public function ValidateUser()
 {
     if ($this->GetOAuth2Info() === null) {
         throw new ValidationException('OAuth2Info', null, 'OAuth 2.0 configuration is required.');
     }
     parent::ValidateOAuth2Info();
     if ($this->GetApplicationName() === null || trim($this->GetApplicationName()) === '' || strpos($this->GetApplicationName(), self::DEFAULT_APPLICATION_NAME) !== false) {
         throw new ValidationException('applicationName', null, sprintf("The property applicationName is required and cannot be " . "null, the empty string, or the default [%s]", self::DEFAULT_APPLICATION_NAME));
     }
 }
Пример #4
0
 /**
  * Validates the user and throws a validation error if there are any errors.
  * @throws ValidationException if there are any validation errors
  */
 public function ValidateUser()
 {
     if ($this->GetOAuth2Info() !== NULL) {
         parent::ValidateOAuth2Info();
     } else {
         if ($this->GetAuthToken() == NULL) {
             if (!isset($this->email)) {
                 throw new ValidationException('email', NULL, 'email is required and cannot be NULL.');
             }
             if (!isset($this->password)) {
                 throw new ValidationException('password', NULL, 'password is required and cannot be NULL.');
             }
             // Generate an authToken.
             $this->RegenerateAuthToken();
         }
     }
     if ($this->GetUserAgent() == NULL) {
         throw new ValidationException('userAgent', NULL, 'userAgent is required and cannot be NULL.');
     }
     if ($this->GetDeveloperToken() == NULL) {
         throw new ValidationException('developerToken', NULL, 'developerToken is required and cannot be NULL.');
     }
 }
 /**
  * Validates the user and throws a validation error if there are any errors.
  * @throws ValidationException if there are any validation errors
  */
 public function ValidateUser()
 {
     if ($this->GetOAuth2Info() !== NULL) {
         parent::ValidateOAuth2Info();
     } else {
         if ($this->GetAuthToken() === NULL) {
             if (!isset($this->email)) {
                 throw new ValidationException('email', NULL, 'email is required and cannot be NULL.');
             }
             if (!isset($this->password)) {
                 throw new ValidationException('password', NULL, 'password is required and cannot be NULL.');
             }
             // Generate an authToken.
             $this->RegenerateAuthToken();
         }
     }
     if ($this->GetUserAgent() === NULL || trim($this->GetUserAgent()) === '' || strpos($this->GetUserAgent(), self::DEFAULT_USER_AGENT) !== false) {
         throw new ValidationException('userAgent', NULL, sprintf("The property userAgent is required and cannot be " . "NULL, the empty string, or the default [%s]", self::DEFAULT_USER_AGENT));
     }
     if ($this->GetDeveloperToken() === NULL) {
         throw new ValidationException('developerToken', NULL, 'developerToken is required and cannot be NULL.');
     }
 }
 /**
  * Validates the user and throws a validation error if there are any errors.
  * @throws ValidationException if there are any validation errors
  */
 public function ValidateUser()
 {
     if ($this->GetOAuth2Info() !== NULL) {
         parent::ValidateOAuth2Info();
     } else {
         if ($this->GetAuthToken() == NULL) {
             if (!isset($this->email)) {
                 throw new ValidationException('email', NULL, 'email is required and cannot be NULL.');
             }
             if (!isset($this->password)) {
                 throw new ValidationException('password', NULL, 'password is required and cannot be NULL.');
             }
             // Generate an authToken.
             $this->RegenerateAuthToken();
         }
     }
     if ($this->GetApplicationName() === NULL || trim($this->GetApplicationName()) === '' || strpos($this->GetApplicationName(), self::DEFAULT_APPLICATION_NAME) !== false) {
         throw new ValidationException('applicationName', NULL, sprintf("The property applicationName is required and cannot be " . "NULL, the empty string, or the default [%s]", self::DEFAULT_APPLICATION_NAME));
     }
 }
Пример #7
0
 /**
  * Validates the user and throws a validation error if there are any errors.
  * @throws ValidationException if there are any validation errors
  */
 public function ValidateUser()
 {
     if ($this->GetOAuth2Info() === null) {
         throw new ValidationException('OAuth2Info', null, 'OAuth 2.0 configuration is required.');
     }
     parent::ValidateOAuth2Info();
     if ($this->GetUserAgent() === null || trim($this->GetUserAgent()) === '') {
         $this->SetUserAgent(self::DEFAULT_USER_AGENT);
     } else {
         if (mb_check_encoding($this->GetUserAgent(), 'ASCII') === false) {
             throw new ValidationException('userAgent', $this->GetUserAgent(), 'The property userAgent must contain only ASCII characters');
         }
     }
     if ($this->GetDeveloperToken() === null) {
         throw new ValidationException('developerToken', null, 'developerToken is required and cannot be null.');
     }
 }