如何生成OAuth客户标识符和客户端的秘密?

编程入门 行业动态 更新时间:2024-10-17 07:38:14
本文介绍了如何生成OAuth客户标识符和客户端的秘密?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我实现一个的OAuth2供应商,我想在我的网站,开发人员登录并注册第三方应用程序的某个地方有一个区域。但我有一个关于如何生成的应用程序的客户端标识符和客户端秘密的疑虑。他们应该是唯一的随机codeS,或者他们必须有一些有意义的信息给客户端?我想他们可能是随机的。

I'm implementing an OAuth2 provider, and I would like to have an area somewhere in my web site where developers log on and register third party apps. But I'm having doubts on how to generate the apps's client identifier and client secret. Should they be unique random codes, or do they have to have some meaningful information to the client? I guess they could be random.

嗯,我一直在寻找如何做到这一点的最佳实践,但还没有找到那么多。所以任何答案将AP preciated。

Well I've been looking for best practices on how to do this, but haven't found that much. So any answers will be appreciated.

PD:Im在.NET MVC3开发了一个名为DotNetOpenAuth库

PD: Im developing on .NET MVC3 with a library called DotNetOpenAuth.

推荐答案

客户端标识符可以是任何你想要的。它可以是他们的选择或任何随机字符串。

The client identifier can be anything you want. It can be their choice or any random string.

客户端秘密应该是一个加密的强随机字符串。这里是你如何生成一个

The client secret should be a cryptographically strong random string. Here is how you can generate one:

RandomNumberGenerator cryptoRandomDataGenerator = new RNGCryptoServiceProvider(); byte[] buffer = new byte[length]; cryptoRandomDataGenerator.GetBytes(buffer); string uniq = Convert.ToBase64String(buffer); return uniq;

更多推荐

如何生成OAuth客户标识符和客户端的秘密?

本文发布于:2023-11-07 15:24:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1566811.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:标识符   客户端   秘密   客户   OAuth

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!