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
pip install pyoidc-redis-session-backend
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:
- Run
python3 -m venv env
- Run
source env/bin/activate
- 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
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
Hashes for pyoidc-redis-session-backend-1.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d53df053af6e7e2a535e638c89da2c738164989689204b2492fdb9df5a4f3478 |
|
MD5 | 416a9558b0d6ca804547eaaf1b59aca7 |
|
BLAKE2b-256 | fbd157fed4161101f47a601e921ecd043cd4ce41f0ff2b9efd008c7e3b6c8925 |
Hashes for pyoidc_redis_session_backend-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4da1658fe7775da33263d719d69b14394734c20cececd7df31fe72a0a16d8098 |
|
MD5 | 6c565999c876c987e85ca92be6367b55 |
|
BLAKE2b-256 | 35a68be433b19b7ee881b369a539f74d666aabce92535bc50d87f6696a467efa |