目前,我正在使用OpenID(通過C#和DotNetOpenAuth)在應用程序A('其應用程序')和應用程序B('我的應用程序')之間創建單一登錄功能。在DotNetOpenAuth中強制使用不同的屬性交換名稱空間
我希望利用屬性交換來獲取其應用程序提供的數據。他們的API文檔AX請求應該是什麼樣子:
openid.ns.ax = http://openid.net/srv/ax/1.0
openid.ax.type.studentids = http://theirapp.com/path/student-ids
注意.ax命名空間。 That seems in line with OpenID's AX specs.
這是我如何使用DotNetOpenAuth申請和獲得的屬性,as suggested by SO和一個極大其它來源:
FetchRequest ax = new FetchRequest();
ax.Attributes.AddRequired("http://theirapp.com/path/student-ids");
request.AddExtension(ax);
和
string sIDs = String.Empty;
if (fetch != null)
sIDs = fetch.GetAttributeValue("http://theirapp.com/path/student-ids");
我困惑時的反應回來完全不理AX要求。觀察查詢字符串參數我們送他們之後,我想它實際上不是他們的錯:
openid.ns:http://specs.openid.net/auth/2.0
openid.ns.alias3:http://openid.net/srv/ax/1.0
openid.alias3.required:alias1
openid.alias3.mode:fetch_request
openid.alias3.type.alias1:http://theirapp.com/path/student-ids
openid.alias3.count.alias1:1
什麼是地獄,DotNetOpenAuth? 'alias3'從哪裏來?這應該是'斧頭'。我無法判斷我正在使用的應用程序是否過分抨擊AX名稱空間,或者DotNetOpenAuth沒有注意強制OpenID協議。
所以,畢竟這個瘤子,我的問題:
- 我需要我的AX請求在命名空間openid.ax,不openid.alias3。我如何強制DotNetOpenAuth來做到這一點?
- 該API要求所請求的屬性被命名爲 - 在這種情況下,'student-ids'。上面,他們得到了默認名稱,如'alias1'。如何強制DotNetOpenAuth使用自定義名稱標記屬性?
- 誰在這裏:需要openid.ax或DotNetOpenAuth不關心的API?
後續:使用Fiddler來嘗試ax命名空間是一個好主意。它最終證明提供者期望a)AX中的請求和b)明確命名的屬性。他們生氣地說,一個解決方案即將到來......最終。在那之前我不確定我會做什麼...... – spamguy
+1 Thanks Andrew。如果沒有你的答案,找到解決方法本來是一條漫長的道路。 – Brandon
確實。如果可以的話,我會接受布蘭登和你的答案。 – spamguy