Skip to main content

Client for the PamAuthService

Project description

PamAuthServiceClient

Client for the 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)

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.

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

PamAuthServiceClient-0.3.1.tar.gz (13.5 kB view hashes)

Uploaded source

Built Distribution

PamAuthServiceClient-0.3.1-py2.py3-none-any.whl (5.7 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page