Okta JWT访问令牌验证程序
okta-jwt的Python项目详细描述
Okta Jwt
Okta JWT使用缓存JWKS的Python访问令牌验证器。
链接到pypi-单击here
安装
pipinstallokta_jwt
使用量
要生成令牌,需要传入issuer
、client_id
、client_secret
、username
和password
作为参数
>>>fromokta_jwt.jwtimportgenerate_token>>>generate_token(issuer,client_id,client_secret,username,password)
这将生成并返回okta访问令牌。
要验证访问令牌,需要传入access_token
、issuer
、audience
和client_ids
作为参数。您可以传入多个客户机ID
>>>fromokta_jwt.jwtimportvalidate_token>>>validate_token(access_token,issuer,audience,client_ids)
如果令牌有效,则它将返回有效负载。
运行测试
要运行单元测试,请运行
$ python -m unittest
分解为测试
单元测试几乎涵盖了包的所有主要功能,比如生成令牌、验证令牌和验证声明。
贡献
github上的https://github.com/adithyasampatoor/okta_jwt上欢迎错误报告和请求(pr)。这个项目旨在成为一个安全的、受欢迎的协作空间,贡献者应该遵守Contributor Covenant行为准则。
作者
- adithya sampatoor