Metadata-Version: 2.1
Name: puaa
Version: 0.3.1
Summary: Python UAA test server
Home-page: https://gitlab.com/romk/puaa
Author: romk
Author-email: r0mk@gmx.net
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Testing :: Mocking
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3
Description-Content-Type: text/markdown
Requires-Dist: Authlib
Requires-Dist: cryptography
Requires-Dist: Flask
Requires-Dist: gunicorn[gevent]
Requires-Dist: PyYAML (>=3.12)

# 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


