用DotNetOpenAuth實現基於OAuth 2.0的web api授權 (一)Getting Start


1. 下載 源碼下載

2. build solution,創建虛擬目錄:

右健MyContatacts/MyPromo項目,選擇Properties,點擊左邊的Web,點擊 Create Virtual Directory 按鈕:

image

 

建完之后,你的iis里應該有二個site: Contacts 和 Promo

image

3. 加入下面二行到你的host文件,這里沒有用port,而是用域名:

127.0.0.1 www.my-contacts123.com
127.0.0.1 www.my-promo123.com

4. 打開Visual Studio 2012里Developer command prompt,分別運行下面二行生成證書:

makecert.exe -sr LocalMachine -ss My -a sha1 -n CN=AuthSrv -sky exchange -pe
makecert.exe -sr LocalMachine -ss My -a sha1 -n CN=ResSrv -sky exchange –pe

5.給iisuser訪問權限:

run –> mmc

選擇File ➤ Add/Remove snap-in

選擇Certificates,點擊Add
選擇Computer account, local computer
找到 Personal ➤ Certificates. 右擊certificate ,選擇Manage Private Keys

image

6. 打開瀏覽器:

輸入http://www.my-promo123.com/promo, 點 Get Contacts 按鈕:

image

輸入用戶名密碼: awen / awen , 點 Sign In:

image

點Yes :

image

image


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM