Skip to main content

Python authentication for FIWARE Data Space

Project description

Python Authentication for FIWARE Data Space (FDSAuth) example workflow

Welcome to the Python Authentication for FIWARE Data Space repository. This library, or FDSAuth, facilitates seamless FIWARE Data Space framework authentication. With built-in support for various authentication protocols and methods, FDSAuth helps developers implement secure and reliable authentication in their applications, ensuring compliance with FIWARE standards and best practices.

Table of Contents 📚

Installation 🛠️

To install FDSAuth, simply use pip:

pip install fdsauth

Usage 💻

First a DID (Decentralized Identifier) and the corresponding key-material is required. You can create such via:

mkdir certs && cd certs
docker run -v $(pwd):/cert quay.io/wi_stefan/did-helper:0.1.1

Define following environment variables in your .env file. Substitute example values for your own:

export KEYCLOAK_URL="http://keycloak-consumer.127.0.0.1.nip.io:8080"
export DATA_SERVICE_URL="http://mp-data-service.127.0.0.1.nip.io:8080"
export REALM="test-realm"
export CLIENT_ID="admin-cli"
export USERNAME="test-user"
export PASSWORD="test"
export CREDENTIAL_CONFIGURATION_ID="user-credential"
export CREDENTIAL_IDENTIFIER="user-credential"
export PRIVATE_KEY_PATH="./certs/private-key.pem"
export DID_PATH="./certs/did.json"

Usage example:

from dotenv import load_dotenv
from fdsauth import Consumer, Provider
import os

# Load environment variables from .env file
load_dotenv()

#Create a Consumer instance and retrieve the auth token
consumer = Consumer(
    keycloak_url=os.getenv("KEYCLOAK_URL"),
    data_service_url=os.getenv("DATA_SERVICE_URL"),
    realm=os.getenv("REALM"),
    client_id=os.getenv("CLIENT_ID"),
    username=os.getenv("USERNAME"),
    password=os.getenv("PASSWORD"),
    credential_configuration_id=os.getenv("CREDENTIAL_CONFIGURATION_ID"),
    credential_identifier=os.getenv("CREDENTIAL_IDENTIFIER"),
    private_key_path=os.getenv("PRIVATE_KEY_PATH"),
    did_path=os.getenv("DID_PATH"),
)
auth_token = consumer.get_auth_token()

Development 🚀

# Create virtual env
python3 -m venv ./venv && source ./venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Build
python setup.py sdist bdist_wheel

# Local testing
pip install dist/fdsauth-X.X.X-py3-none-any.whl

Contact 📫

For any questions or support, please reach out to us via GitHub Issues or email us at joamoteo@upv.es.

Acknowledgments 🙏

This work has been made by VRAIN for the CitCom.ai project, co-funded by the EU.

VRAIN CitCom.ai

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

fdsauth-0.0.5.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

fdsauth-0.0.5-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file fdsauth-0.0.5.tar.gz.

File metadata

  • Download URL: fdsauth-0.0.5.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for fdsauth-0.0.5.tar.gz
Algorithm Hash digest
SHA256 596c5237372b05724d73a0060b776bdc8b7ab7672d2a3ae67b7a54977b38f8c2
MD5 4ca7713e3b6c0e654ce5ce3fc34858ed
BLAKE2b-256 7468deb1a9a53b087b11a975dc2a9a3203534a239127c1985fc715256aea9e29

See more details on using hashes here.

File details

Details for the file fdsauth-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: fdsauth-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for fdsauth-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 253efd62905bc9b601729ac6e950d785772669b3d3d17d3f67bc3f96c2740292
MD5 69dcaae3ccadfc26290180df2d0d131b
BLAKE2b-256 49e3ee730e22fb5decfb062b1b4ccc427fb899b27597c7443d2d35c41261687c

See more details on using hashes here.

Supported by

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