简体   繁体   English

使用Dotnet Open Auth创建访问令牌

[英]Create Access Token using Dotnet Open Auth

I have a website which contains lot of user informations. 我有一个网站,其中包含许多用户信息。 I want to share those with client website through proper authentication. 我想通过适当的身份验证与客户网站共享这些内容。 As I am going to develop this api using asp.net mvc 4, I selected DotnetOauth for providing authentication. 当我要使用asp.net mvc 4开发此api时,我选择了DotnetOauth来提供身份验证。 If a website want to access my data from website, they have to register with my developer website, after the registration that website will generate Consumer key and Secret Key . 如果网站要从该网站访问我的数据,则必须在我的开发者网站上注册,该网站注册后将生成“ 用户密钥”和“ 秘密密钥” After the registration, for each api request the client will pass these keys. 注册后,对于每个api请求,客户端都将传递这些密钥。 Up to this is done. 至此完成。

Using this Consumer Key and Secret Key, client will send api request and if the valid token is not available in the request, it will redirect to login page. 客户端将使用此使用者密钥和秘密密钥发送api请求,如果请求中没有可用的有效令牌,它将重定向到登录页面。 After the successful login, a token will generate and client can use this token for furthor request up to the expiry. 成功登录后,将生成一个令牌,客户端可以将该令牌用于进一步的请求,直到到期为止。

Anybody have idea about creating token based on Consumer Key and Secret Key with the help of DotnetOauth . 任何人都可以在DotnetOauth的帮助下基于消费者密钥秘密密钥创建令牌想法 Iam using Asp.net MVC 使用Asp.net MVC的Iam

Thanks 谢谢

In order to create an access token using DNOA, you should implement the interface IAuthorizationServerHost. 为了使用DNOA创建访问令牌,您应该实现IAuthorizationServerHost接口。 The method CreateAccessToken is the responsible of creating the token. CreateAccessToken方法负责创建令牌。

I recommend you to download DotNetOpenAuth samples, and have a look to 'OAuthAuthorizationServer' project. 我建议您下载DotNetOpenAuth示例,并查看“ OAuthAuthorizationServer”项目。

Hope this help. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM