用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

posted @ 2014-02-10 11:35  疯吻IT  阅读(5077)  评论(16编辑  收藏  举报