Google を使用して StackOverflow にサインインすると、次のメッセージが表示されます。
Stackoverflow.com は、あなたの Google アカウント example@gmail.com からいくつかの情報を求めています
• メールアドレス: example@gmail.com
ただ、自分のサイトではOpenIDでログインするとメールアドレスを聞かれません。代わりに、次のメッセージが表示されます。
Google アカウント example@gmail.com で example.com にサインインしています
また、どのステップでメールアドレスを要求する必要があるのか 理解するのが難しいと感じています. ステップを組み込む必要があると思われるコードは次のとおりです。
/**
* Authenticates the given OpenId identity.
* Defined by Zend_Auth_Adapter_Interface.
*
* @throws Zend_Auth_Adapter_Exception If answering the authentication query is impossible
* @return Zend_Auth_Result
*/
public function authenticate() {
$id = $this->_id;
$consumer = new Auth_OpenID_Consumer($this->_storage);
if (!empty($id)) {
$authRequest = $consumer->begin($id);
if (is_null($authRequest)) {
return new Zend_Auth_Result(
Zend_Auth_Result::FAILURE,
$id,
array("Authentication failed", 'Unknown error')
);
}
if (Auth_OpenID::isFailure($authRequest)) {
return new Zend_Auth_Result(
Zend_Auth_Result::FAILURE,
$id,
array("Authentication failed", "Could not redirect to server: " . $authRequest->message)
);
}
$redirectUrl = $authRequest->redirectUrl($this->_root, $this->_returnTo);
if (Auth_OpenID::isFailure($redirectUrl)) {
return new Zend_Auth_Result(
Zend_Auth_Result::FAILURE,
$id,
array("Authentication failed", $redirectUrl->message)
);
}
Zend_OpenId::redirect($redirectUrl);
} else {
$response = $consumer->complete(Zend_OpenId::selfUrl());
switch($response->status) {
case Auth_OpenID_CANCEL:
case Auth_OpenID_FAILURE:
return new Zend_Auth_Result(
Zend_Auth_Result::FAILURE,
null,
array("Authentication failed. " . @$response->message)
);
break;
case Auth_OpenID_SUCCESS:
return $this->_constructSuccessfulResult($response);
break;
}
}
}
これはとても明白なように思えます...しかし、私はそれをグーグルで検索し、コードをくまなく調べて理解するのに苦労しています。どんな助けでも大歓迎です!