实现生成apiKey接口,便于第三方应用直接在token里携带过来进行认证 #718
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
参考了别的项目apiKey生成和鉴权机制,结合本项目的Oauth2的鉴权机制,在不多新增表的情况下,复用Oauth2的生成token机制,将apiKey的key过期时间设置50年后,并且不需要refreshToken的刷新机制。
目前还有点待完善的是当前clientId在代码里设置成apiKey,用户如果在创建第三方应用时如果也写apiKey为客户端编码的话,可能会有一些冲突。
当前简单实现后的效果如下: