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