python uaa测试服务器
puaa的Python项目详细描述
puaa
python中的uaa测试服务器。 主要目的是充当一个易于配置的模拟oauth服务器。
注意:它不是一个安全的OAuth服务器,决不能在生产机器上使用。
安装
像任何python包一样:
pip install puaa
配置
服务器是通过一个普通的uaa.yml配置的,但只使用一个很小的子集 其中,主要是“jwt”和“oauth”部分:
issuer:
uri: http://localhost:8080
oauth:
clients:
test:
id: test
secret: test
authorized-grant-types: client_credentials
scope: none
authorities: uaa.admin,clients.admin,clients.read,clients.write,clients.secret
jwt:
token:
policy:
accessTokenValiditySeconds: 3600
activeKeyId: key-id-1
keys:
key-id-1:
signingKey: |
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
在本地运行
开始时需要几个环境变量:
export AUTHLIB_INSECURE_TRANSPORT=true
export UAA_CONFIG_FILE=<PATH>/uaa.yaml
gunicorn -k gevent puaa.app:app
然后可以检索令牌,例如:
curl -sS 'http://localhost:8000/oauth/token' -u test:test -d 'grant_type=client_credentials'
限制
目前只支持“客户端凭据”授权。
备选方案
完整的uaa服务器https://github.com/cloudfoundry/uaa/ 但我放弃了按我的意愿配置它。
许可证
麻省理工学院许可证