我使用此命令生成私有 ed25519 密钥:
openssl genpkey -algorithm ed25519 -out private.pem
Run Code Online (Sandbox Code Playgroud)
这是示例结果:
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIAYIsKL0xkTkAXDhUN6eDheqODEOGyFZ04jsgFNCFxZf
-----END PRIVATE KEY-----
Run Code Online (Sandbox Code Playgroud)
然后我想根据这个私钥生成一个公钥,我这样做:
openssl pkey -in private.pem -out public.pem
Run Code Online (Sandbox Code Playgroud)
但通过这个命令我仍然得到一个如下所示的私钥:
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIAYIsKL0xkTkAXDhUN6eDheqODEOGyFZ04jsgFNCFxZf
-----END PRIVATE KEY-----
Run Code Online (Sandbox Code Playgroud)
此外,这个私钥和“公钥”不是 32 字节,而是 64 字节。我的命令有什么问题?
我的问题是确定何时刷新访问令牌。
我读过,我应该在每次请求之前刷新新的访问令牌,但它在其他地方说不建议这样做。所以我的问题是我是否应该在每次请求之前刷新访问令牌,或者发送请求并在收到 401 未经授权状态后刷新访问令牌并重试对指定资源的请求。
想象一下使用微服务的 OAuth 提供商。我们将为授权端点、令牌端点等提供微服务。
For example, every endpoint is different microservice and most endpoints will need to retrieve client by id to authenticate request. So how should I share method to get client from database, model for client and all related to it entities?
How shall I share common methods and classes between microservices?
If microservice A depends on microservice B, then I need to do communication between them over HTTP or I just can add project reference? Or maybe situation …