Skip to main content

Python authentication for FIWARE Data Space

Project description

Python Authentication for FIWARE Data Space (FDSAuth) PyPI - Version package workflow

FDSAuth helps developers implement secure and reliable FIWARE Data Space Connector authentication in their applications.

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

Usage example:

from fdsauth import Consumer
import requests

consumer = Consumer(
    keycloak_protocol="http",
    keycloak_endpoint="keycloak.consumer-a.local",
    keycloak_realm_path="realms/test-realm/protocol",
    keycloak_user_name="test-user",
    keycloak_user_password="test",
    apisix_protocol="http",
    apisix_endpoint="apisix-proxy.provider-a.local",
    certs_path="./certs",
)

try:
    # Attempt to access data using the obtained service token. Get entities of type EnergyReport.
    url = f"http://apisix-proxy.provider-a.local/ngsi-ld/v1/entities?type=EnergyReport"
    headers = {
        "Accept": "application/json",
        "Authorization": f"Bearer {consumer.get_data_service_access_token()}",
    }
    response = requests.get(url, headers=headers)
    response.raise_for_status()
    print(response.json())
except Exception as req_err:
    print(f"Request error occurred: {req_err}")

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.6.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

fdsauth-0.0.6-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fdsauth-0.0.6.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fdsauth-0.0.6.tar.gz
Algorithm Hash digest
SHA256 7e37b666c42bbbfba74b8869c3adc5a39fd7ea246e9020444c75f48d1433e863
MD5 2fb4e53238139b09e3583cf5c662cf97
BLAKE2b-256 c367cc875b228354fa2f33dbef0c0622d089d484fbb75425e660ae3a3ab100f9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fdsauth-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fdsauth-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b5fb417883cb9339457f3979858b2a967d32176028f1edca97521837b26a848e
MD5 49d4de0e09e132f513e738aff43c9d9d
BLAKE2b-256 4de535762301d77e05e939d68322849ae26eeebd6882388fddc2b185c693fe20

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