我可能失去了一些東西真的傻了,錯過了Google Federated Login文檔中,但如何在谷歌OpenID登錄實際上確保對請求的網站?請求網站如何知道細節來自Google,而不僅僅是有人在URL中輸入查詢字符串參數?保護的谷歌的OpenID細節潛在欺騙到請求站點
爲了說明這一點,我在PHP中實現了一個基本的OpenID登錄序列,並且所有似乎返回的結果都是URL中的一串查詢字符串參數,我可以使用它來獲取OpenID詳細信息,這非常有效。問題是,如果我只是手動輸入到地址欄而沒有實際登錄Google,我的請求站點如何知道它們的區別?
首先,形式請求細節:
<form method='post' action='https://www.google.com/accounts/o8/ud'>
<input type='hidden' name='openid.return_to' value='http://www.example/com/logged-in' />
<input type='hidden' name='openid.mode' value='checkid_setup' />
<input type='hidden' name='openid.ns' value='http://specs.openid.net/auth/2.0' />
<input type='hidden' name='openid.claimed_id' value='http://specs.openid.net/auth/2.0/identifier_select' />
<input type='hidden' name='openid.identity' value='http://specs.openid.net/auth/2.0/identifier_select' />
<input type='hidden' name='openid.ns.ax' value='http://openid.net/srv/ax/1.0' />
<input type='hidden' name='openid.ax.mode' value='fetch_request' />
<input type='hidden' name='openid.ax.required' value='email,firstname,lastname' />
<input type='hidden' name='openid.ax.type.email' value='http://axschema.org/contact/email' />
<input type='hidden' name='openid.ax.type.firstname' value='http://axschema.org/namePerson/first' />
<input type='hidden' name='openid.ax.type.lastname' value='http://axschema.org/namePerson/last' />
<input type='submit' value='Login With Google Account' />
</form>
...偉大的工程,有一大堆的URL參數,如下圖所示送我回請求站點http://www.example.com/logged-in
(從PHP print_r
調用):
Array
(
[openid_ns] => http://specs.openid.net/auth/2.0
[openid_mode] => id_res
[openid_return_to] => http://www.example.com/logged-in
[openid_ext1_type_firstname] => http://axschema.org/namePerson/first
[openid_ext1_value_firstname] => {user's first name}
[openid_ext1_type_email] => http://axschema.org/contact/email
[openid_ext1_value_email] => {user's e-mail address}
[openid_ext1_type_lastname] => http://axschema.org/namePerson/last
[openid_ext1_value_lastname] => {user's last name}
)
...這是真棒,但我怎麼知道,這其實就是一個合法的要求,而不是有人在上面的參數輸入到地址欄?
感謝您的幫助,道歉,如果這已被要求已經(找不到任何副本!),如果我失去了一些東西明顯!
只是不?真的嗎?你知道你讓我想更多地調查這個,對嗎? ; P我最近遇到了另一個利用OpenID的方面,特別是Google登錄,稱爲'nonce'。基本上只使用一次的隨機數,這些隨機數的可以用來幫助保護認證,但它仍然看起來像一個狂熱的黑客可以在上面和僞造仍然跳自己的方式。感謝您抽出寶貴時間來回應史蒂夫! – 2012-01-27 09:40:14