Add OIDC back-channel logout with session indexes
CI / Build and publish packages (push) Failing after 14s
CI / Build and publish packages (push) Failing after 14s
This commit is contained in:
@@ -66,6 +66,37 @@ session and creates a fresh empty one.
|
||||
Set `max_age=None` to disable server-side expiry (and the `Max-Age` cookie
|
||||
attribute) entirely.
|
||||
|
||||
## Session indexes
|
||||
|
||||
Authentication layers can attach reverse-index metadata to a session without
|
||||
adding it to the user-visible session dictionary:
|
||||
|
||||
```python
|
||||
ctx.session.add_index('oidc:default:sub', 'user-123')
|
||||
```
|
||||
|
||||
Index-capable stores persist these memberships on `save()` and maintain them
|
||||
across session ID rotation and deletion:
|
||||
|
||||
```python
|
||||
session_ids = await store.find_sessions('oidc:default:sub', 'user-123')
|
||||
deleted = await store.delete_by_index('oidc:default:sub', 'user-123')
|
||||
```
|
||||
|
||||
Use `session.remove_index(name, value)` to remove a membership while keeping
|
||||
the session. `SessionMixin.store` exposes the backing store for features such
|
||||
as back-channel logout.
|
||||
|
||||
`InMemorySessionStore`, `RedisSessionStore`, and `MemcacheSessionStore` set
|
||||
`supports_indexes = True`. Custom stores can opt in by setting that flag,
|
||||
implementing `find_sessions()`, maintaining reverse memberships on `save()`,
|
||||
and removing them on `delete()`. `delete_by_index()` has a generic default
|
||||
implementation based on `find_sessions()` and `delete()`.
|
||||
|
||||
Remote stores serialize an envelope containing both the session dictionary and
|
||||
its index metadata. Existing plain-dict payloads remain readable and are
|
||||
upgraded on the next save.
|
||||
|
||||
## Features
|
||||
|
||||
- `Session`: dict-like session object with modification tracking
|
||||
@@ -74,6 +105,7 @@ attribute) entirely.
|
||||
- `SessionMixin`: composable Kaya mixin managing session cookies and persistence
|
||||
- Session ID regeneration (`session.regenerate_id()`) and invalidation
|
||||
(`session.invalidate()`) for authentication layers
|
||||
- Reverse session indexes for looking up and invalidating sessions by metadata
|
||||
- WebSocket support: the session is exposed as `ws.session` in websocket
|
||||
handlers, loaded at connect time and persisted on close
|
||||
|
||||
|
||||
Reference in New Issue
Block a user