yii\authclient\OpenId::buildAuthUrlV2 PHP Method

buildAuthUrlV2() protected method

Builds authentication URL for the protocol version 2.
protected buildAuthUrlV2 ( array $serverInfo ) : string
$serverInfo array OpenID server info.
return string authentication URL.
    protected function buildAuthUrlV2($serverInfo)
    {
        $params = ['openid.ns' => 'http://specs.openid.net/auth/2.0', 'openid.mode' => 'checkid_setup', 'openid.return_to' => $this->getReturnUrl(), 'openid.realm' => $this->getTrustRoot()];
        if ($serverInfo['ax']) {
            $params = array_merge($params, $this->buildAxParams());
        }
        if ($serverInfo['sreg']) {
            $params = array_merge($params, $this->buildSregParams());
        }
        if (!$serverInfo['ax'] && !$serverInfo['sreg']) {
            // If OP doesn't advertise either SREG, nor AX, let's send them both in worst case we don't get anything in return.
            $params = array_merge($this->buildSregParams(), $this->buildAxParams(), $params);
        }
        if ($serverInfo['identifier_select']) {
            $url = 'http://specs.openid.net/auth/2.0/identifier_select';
            $params['openid.identity'] = $url;
            $params['openid.claimed_id'] = $url;
        } else {
            $params['openid.identity'] = $serverInfo['identity'];
            $params['openid.claimed_id'] = $this->getClaimedId();
        }
        return $this->buildUrl($serverInfo['url'], ['query' => http_build_query($params, '', '&')]);
    }