Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 08ee20ac07 | |||
| 6a51c15dbf | |||
| df20bbff18 |
@@ -0,0 +1,9 @@
|
||||
include LICENSE
|
||||
include CHANGELOG.md
|
||||
include README.md
|
||||
include setup.cfg
|
||||
recursive-include quart_session *.py
|
||||
recursive-include quart_session *.md
|
||||
exclude .gitlab-ci.yml
|
||||
exclude examples
|
||||
exclude docs
|
||||
@@ -1,4 +1,6 @@
|
||||
# Quart-session
|
||||
# Quart-Session
|
||||
|
||||
 [](https://pypi.org/project/Quart-Session/) 
|
||||
|
||||
Quart-Session is an extension for Quart that adds support for
|
||||
server-side sessions to your application.
|
||||
@@ -55,13 +57,13 @@ app.config['SESSION_TYPE'] = 'redis'
|
||||
|
||||
@app.before_serving
|
||||
async def setup():
|
||||
cache = await aioredis.create_redis_pool({"address": "..."})
|
||||
cache = await aioredis.create_redis_pool(...)
|
||||
app.config['SESSION_REDIS'] = cache
|
||||
Session(app)
|
||||
```
|
||||
|
||||
By default, Quart-session creates a single connection to Redis, while
|
||||
the example above creates a connection pool.
|
||||
the example above sets up a connection pool.
|
||||
|
||||
#### Trio support
|
||||
|
||||
@@ -149,9 +151,9 @@ To re-gain the old behaviour of always emitting a `Set-Cookie` header on static
|
||||
set `SESSION_STATIC_FILE` to `True`.
|
||||
|
||||
|
||||
### Session hijack prevention
|
||||
### Session pinning
|
||||
|
||||
(Optionally) pins an user's session to his/her IP address. This mitigates cookie stealing via XSS etc, and is handy
|
||||
Associates an user's session to his/her IP address. This mitigates cookie stealing via XSS etc, and is handy
|
||||
for paranoid web applications.
|
||||
|
||||
```python3
|
||||
@@ -161,8 +163,7 @@ app.config['SESSION_HIJACK_PROTECTION'] = True
|
||||
Session(app)
|
||||
```
|
||||
|
||||
With this option, session reuse from a different IP will result in the
|
||||
creation of a new session, and the deletion of the old.
|
||||
Session reuse from a different IP will now result in the creation of a new session, and the deletion of the old.
|
||||
|
||||
**Important:** If your application is behind a reverse proxy, it most
|
||||
likely provides the `X-Forwarded-For` header which you **must** make use of
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
__version__ = '0.0.1'
|
||||
|
||||
import os
|
||||
import sniffio
|
||||
from typing import Optional
|
||||
|
||||
from quart import Quart
|
||||
|
||||
@@ -14,6 +14,9 @@ Links
|
||||
"""
|
||||
from setuptools import setup
|
||||
|
||||
with open('README.md') as f:
|
||||
long_description = f.read()
|
||||
|
||||
|
||||
INSTALL_REQUIRES = [
|
||||
"Quart>=0.10.0"
|
||||
@@ -27,7 +30,8 @@ setup(
|
||||
author='dsc',
|
||||
author_email='dsc@xmr.pm',
|
||||
description='Adds server-side session support to your Quart application',
|
||||
long_description=__doc__,
|
||||
long_description=long_description,
|
||||
long_description_content_type='text/markdown',
|
||||
packages=['quart_session'],
|
||||
zip_safe=False,
|
||||
include_package_data=True,
|
||||
|
||||
Reference in New Issue
Block a user