Skip to main content

Pebble client tool for authenticate user and licence management written in Python

Project description

Pebble Authentication Client for NodeJS

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.

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

Solution 3 : Dockerfile configuration

Add the following in your Dockerfile after the initialization of docker image and the implementation of Python3 in the docker container :

RUN pip install pebbleauthclient

Dockerfile example

WARNING : This is an example in order to explain when you have to run the pip install command. Your own Dockerfile should vary from this configuration.

# syntax=docker/dockerfile:1.2
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y python3.9 python3.9-dev
RUN pip install pebbleauthclient
COPY . .
CMD ["python"]

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 :

RUN export PBL_JWKS_REMOTE_URI=https://SERVER_URI/path/jwks.json

Test keys pair

Warn : These key files are not secured and must be used FOR TESTING PURPOSE ONLY on a local development environment !

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)

Authenticate with HTTP Authorization header

Content will be published soon.

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

pebbleauthclient-0.1.2.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pebbleauthclient-0.1.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file pebbleauthclient-0.1.2.tar.gz.

File metadata

  • Download URL: pebbleauthclient-0.1.2.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for pebbleauthclient-0.1.2.tar.gz
Algorithm Hash digest
SHA256 6b40ab25269584de937c0fdf15d81d82cd18d0ae07dc030c9af10b0020668786
MD5 96f56135d61ba8ec364dc60f15f42b46
BLAKE2b-256 b40ad28e09149af7bd3cf0022cfbea61f60b6e26345fe7e56f023750b6755428

See more details on using hashes here.

File details

Details for the file pebbleauthclient-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pebbleauthclient-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 233fe15b598e3f1547636de4a1d8f342cc71f52fab564273e232c7ac6727c357
MD5 5a448b993665cbccacf53868866f5239
BLAKE2b-256 cd010a934f705573e329bc68abcee5cc37cbc8334a88dd7148ae7e1c5d6bc0c4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page