Skip to main content

Python UAA test server

Project description

puaa

An uaa test server in python. The main purpose is to serve as an easily configurable mock oauth server.

Attention: it's not a secured OAuth server and must never be used on production machines.

Install

Like any python package:

pip install puaa

Configure

The server is configured through a regular uaa.yml but uses only a small subset of it, mainly "jwt" and "oauth" sections:

issuer:
  uri: http://localhost:8000

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-----

Run locally

Needs few environment variables to start:

export AUTHLIB_INSECURE_TRANSPORT=true
export UAA_CONFIG_FILE=<PATH>/uaa.yaml
gunicorn -k gevent puaa.app:app

Then can retrieve a token with e.g.:

curl -sS http://localhost:8000/oauth/token -u test:test -d 'grant_type=client_credentials'

To list JWT keys:

curl -sS http://localhost:8000/token_keys

Limitations

Supports the "client_credentials" grant only so far.

Alternatives

The full uaa server https://github.com/cloudfoundry/uaa/ But I gave up to configure it as I wish.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

puaa-0.3.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

puaa-0.3.2-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file puaa-0.3.2.tar.gz.

File metadata

  • Download URL: puaa-0.3.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for puaa-0.3.2.tar.gz
Algorithm Hash digest
SHA256 fb624b53a6d719ea56464c4f735d71a38a906062919a2234958ffca7291e9d9b
MD5 584f703a7a550a509257ba074b9ffb17
BLAKE2b-256 6839c9b99215ef70a0aca4ebaa911d8eba461480880b276e5e71bb4d9b376bbe

See more details on using hashes here.

File details

Details for the file puaa-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: puaa-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.4

File hashes

Hashes for puaa-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b9afd72c04a195f2640a184ea8a0ad6fd0421bf8e62a402c3a588deebd0408b3
MD5 334efaa1d242949670421b89b74975bd
BLAKE2b-256 1b944333e302162e4839cd632996f6a1d18971684b41ca5a413b8d28a48ce4b0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page