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

Uploaded Source

Built Distribution

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

Uploaded Python 3

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