崔少飞
发布于 2026-01-22 / 2 阅读
0
0

知识库APIKey

生成

使用SecureRandom生成随机字节,然后再经过base64进行编码,得到最终的api_key

数据库

验证过程

在请求头中通过Authentication获取token,然后从数据库中查找token对应的ApiKey,获取过期时间 expired 和 enable 同时验证,当两者都有效时,apikey判定为有效。


评论