Pebble client tool for authenticate user and licence management written in Python
Project description
Introduction
This library offer a client for authenticate user and licence management written in Python compatible with may python API Server.
Installation
Requirements
The following procedures explains the installation of the following packages :
Python 3.9 or higher
pip (provided with Python package)
PyJWT (tested with version 2.8.0)
cryptography (tested with version 41.0.5)
Solution 1 : requirement.txt configuration
If your project use a requirement.txt configuration file, simply add the following.
requirement.txt file addition:
pebbleauthclient>=0.1.2
Then run this command on your project :
pip install -r requirements.txt
Or in Dockerfile :
RUN pip install -r requirements.txt
Solution 2 : Local installation
Check python3 is properly installed on your local machine (with pip working), then run the following in the application directory.
pip install pebbleauthclient
Or in Dockerfile :
RUN pip install pebbleauthclient
Usage
Configuration
Before you can work with the library, you must define to a system environment variable the URI were is stored the public Json Web Key Set (JWKS file).
This file will be requested and store temporary on your API Server. Your server should be able to write on ./var/credentials/auth/jwks.json . If the file does not exist, it will be created.
If you start your server directly from a terminal, run this command on your terminal before starting your server :
export PBL_JWKS_REMOTE_URI=https://SERVER_URI/path/jwks.json
If you start your server within a Docker container, you should add this line to your Dockefile :
ENV PBL_JWKS_REMOTE_URI=https://SERVER_URI/path/jwks.json
Test keys pair
JWKS URI (for PBL_JWKS_REMOTE_URI environment variable)
https://storage.googleapis.com/pebble-public-cdn/test_auth/jwks_test.json
Public and private keys used to sign a token
https://storage.googleapis.com/pebble-public-cdn/test_auth/public_test.pem
https://storage.googleapis.com/pebble-public-cdn/test_auth/private_test.pem
Authenticate with token string
from pebbleauthclient.auth import auth
try:
authToken = auth("---A_valid_token---")
print(authToken)
print(authToken.get_user())
print(authToken.get_authenticated_licence())
except Exception as e:
print("ERROR: " + e)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pebbleauthclient-0.1.3.tar.gz.
File metadata
- Download URL: pebbleauthclient-0.1.3.tar.gz
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f832d3ed9d13c5234ee8924c19ff14d84bc68b1d928d2df71fe9b75477066658
|
|
| MD5 |
53ab3505d6f9614aa4f8378bcf614954
|
|
| BLAKE2b-256 |
3d08ccb7a971f56f5555461e1f901e6f2af530acb744ca73a436b3f163657b1b
|
File details
Details for the file pebbleauthclient-0.1.3-py3-none-any.whl.
File metadata
- Download URL: pebbleauthclient-0.1.3-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
848fd3596adf45f13651bcbc067f88a9c05ade52d63c4349e2ae70662ca38eed
|
|
| MD5 |
7a6ddc6d8f3a0aaa45e9f4421702c40a
|
|
| BLAKE2b-256 |
68e57b45866017d9f8e11268c1188a3f69ae5409c7667a2a6c0de79e1e25a201
|