Skip to main content

Redis-based session storage for oic library

Project description

pyoidc-redis-session-backend

This repository contains source code for a Redis-based session storage backend for the oic Python library.

Installation

This project hasn't been released to PyPi yet, but you can find the test package in TestPyPi: https://test.pypi.org/project/pyoidc-redis-session-backend-alehuo/.

Usage

A ready-to-run project is located at https://github.com/alehuo/pyoidc-redis-session-backend-example

Below is an example piece of code that initializes a Redis client which is then used to create an instance of RedisSessionBackend. After that, a Consumer is created which is then configured to use the Redis session backend as its backend.

import redis
from pyoidc_redis_session_backend import RedisSessionBackend
from oic.oic.consumer import Consumer
from oic.utils.authn.client import ClientSecretBasic, ClientSecretPost

redis_client = redis.Redis("localhost", "6379")
# Pass the redis client into the Redis session backend
backend = RedisSessionBackend(redis_client)
# Create an example consumer with example config
consumer = Consumer(backend, {
    "authz_page": "/auth/callback", # Callback URL of your app
    "response_type": "code",
},
    client_config={
    "client_id": "your_client_id", # Client ID
    "client_authn_method": {
        'client_secret_post': ClientSecretPost,
        'client_secret_basic': ClientSecretBasic
    }
})
consumer.provider_config("oidc_server_url") # OIDC server URL
consumer.set_client_secret("your_client_secret") # Client secret

Development

To initialize the development environment, run:

  1. Run python3 -m venv env
  2. Run source env/bin/activate
  3. Run pip install -r requirements.txt

Running tests

Run tests with python -m pytest tests/.

Contributions

Contributions to this repository are welcome.

License

This project is licensed with MIT license.

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

pyoidc-redis-session-backend-1.0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file pyoidc-redis-session-backend-1.0.1.tar.gz.

File metadata

  • Download URL: pyoidc-redis-session-backend-1.0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for pyoidc-redis-session-backend-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d41c8f08b91e29d84a2c5672be884ebcf1cfba12f7e1761fd86f1bdafdf5b255
MD5 663fae01b832cdd007e94f1be4b25d3c
BLAKE2b-256 0609e9eea7019c8eebe40c4b246e191eab4fb428fb0af9a7e312164da5d0b8c8

See more details on using hashes here.

File details

Details for the file pyoidc_redis_session_backend-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyoidc_redis_session_backend-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.42.0 CPython/3.7.6

File hashes

Hashes for pyoidc_redis_session_backend-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d33884c1ef0fb191543f05a679555880a7ab3b0b77ceb3878f69777c23df5509
MD5 e788b9033fe4e012329117404158f883
BLAKE2b-256 99b653fb685d7502e7955e586a7c6bb92acaab7726f6ae5c92a7f0b465209f1d

See more details on using hashes here.

Supported by

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