Metadata-Version: 2.1
Name: PamAuthServiceClient
Version: 0.3.1
Summary: Client for the PamAuthService
Home-page: https://in-stigler.htw-aalen.de/gitea/klauck/PamAuthServiceClient
Author: Sebastian Stigler
Author-email: sebastian.stigler@hs-aalen.de
License: mit
Project-URL: Documentation, https://in-stigler.htw-aalen.de/gitea/klauck/PamAuthServiceClient
Platform: any
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Requires-Dist: cryptography
Requires-Dist: jsonschema
Requires-Dist: requests-unixsocket
Requires-Dist: requests
Requires-Dist: setuptools
Requires-Dist: recommonmark
Requires-Dist: sphinx-rtd-theme
Requires-Dist: Sphinx
Provides-Extra: testing
Requires-Dist: pytest ; extra == 'testing'
Requires-Dist: pytest-cov ; extra == 'testing'

# PamAuthServiceClient

Client for the [PamAuthService](https://in-stigler.htw-aalen.de/gitea/klauck/PamAuthService)

## Installation

```
pip install PamAuthServiceClient
```

## Quickstart

Use the `PamAuthService` running on a unix socket at `/run/pam_auth_service.sock`.

(If the `PamAuthService` is running on a network socket use `url` instead of `path`)

```python
from pamauthserviceclient.client import PamAuthServiceClient

encryption_key = 'ENCRYPTION KEY'
verification_key = 'VERIFICATION KEY'

path = "/run/pam_auth_service.sock"
# url = "http://127.0.0.1:5000"

client = PamAuthServiceClient(encryption_key, verification_key, path=path)
# client = PamAuthServiceClient(encryption_key, verification_key, url=url)

res = client.authenticate("name", "password")
# None
#    if  name/password don't match
# {'version': '1.0', 'username': 'name', 'allowed_groups': []}
#    if user/password match

allowed_groups = ["group1", "xxx", "yyy", "zzz"]

res2 = client.authenticate("name", "password", allowed_groups)
# {'version': '1.0', 'username': 'name', 'allowed_groups': ['xxx', 'zzz']}
#    if user is authorized and member of the 'xxx' and 'zzz' group
#    and not member of the other groups.
```


