validate() public method

Performs OpenID verification with the OP.
public validate ( boolean $validateRequiredAttributes = true ) : boolean
$validateRequiredAttributes boolean whether to validate required attributes.
return boolean whether the verification was successful.
示例#1
0
 /**
  * Performs OpenID auth flow.
  * @param OpenId $client auth client instance.
  * @return Response action response.
  * @throws Exception on failure.
  * @throws HttpException on failure.
  */
 protected function authOpenId($client)
 {
     if (!empty($_REQUEST['openid_mode'])) {
         switch ($_REQUEST['openid_mode']) {
             case 'id_res':
                 if ($client->validate()) {
                     return $this->authSuccess($client);
                 } else {
                     throw new HttpException(400, 'Unable to complete the authentication because the required data was not received.');
                 }
                 break;
             case 'cancel':
                 $this->redirectCancel();
                 break;
             default:
                 throw new HttpException(400);
                 break;
         }
     } else {
         $url = $client->buildAuthUrl();
         return Yii::$app->getResponse()->redirect($url);
     }
     return $this->redirectCancel();
 }