Skip to content

Commit 8b5ce6a

Browse files
author
IndominusByte
committed
add docs configuration options
1 parent 007ae67 commit 8b5ce6a

File tree

7 files changed

+57
-34
lines changed

7 files changed

+57
-34
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Build Status](https://travis-ci.org/IndominusByte/fastapi-jwt-auth.svg?branch=master)](https://travis-ci.org/IndominusByte/fastapi-jwt-auth)
66
[![Coverage Status](https://coveralls.io/repos/github/IndominusByte/fastapi-jwt-auth/badge.svg?branch=master)](https://coveralls.io/github/IndominusByte/fastapi-jwt-auth?branch=master)
77
[![PyPI version](https://badge.fury.io/py/fastapi-jwt-auth.svg)](https://badge.fury.io/py/fastapi-jwt-auth)
8-
[![Downloads](https://pepy.tech/badge/fastapi-jwt-auth)](https://pepy.tech/project/fastapi-jwt-auth)
8+
[![Downloads](https://static.pepy.tech/personalized-badge/fastapi-jwt-auth?period=total&units=international_system&left_color=grey&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/fastapi-jwt-auth)
99

1010
---
1111

docs/configuration/cookies.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
1+
These are only applicable if `authjwt_token_location` is use cookies.
2+
13
`authjwt_access_cookie_key`
2-
: is simply dummy text of the printing and typesetting industry
4+
: The key of the cookie that holds the access token. Defaults to `access_token_cookie`
35

46
`authjwt_refresh_cookie_key`
5-
: is simply dummy text of the printing and typesetting industry
7+
: The key of the cookie that holds the refresh token. Defaults to `refresh_token_cookie`
68

79
`authjwt_access_cookie_path`
8-
: is simply dummy text of the printing and typesetting industry
10+
: What path should be set for the access cookie. Defaults to `'/'`, which will cause this
11+
access cookie to be sent in with every request.
912

1013
`authjwt_refresh_cookie_path`
11-
: is simply dummy text of the printing and typesetting industry
14+
: What path should be set for the refresh cookie. Defaults to `'/'`, which will cause this
15+
refresh cookie to be sent in with every request.
1216

1317
`authjwt_cookie_max_age`
14-
: is simply dummy text of the printing and typesetting industry
18+
: If you don't set anything else, the cookie will expire when the browser is closed. Defaults to
19+
`None`, to prevent this set expiration to `int` (expressed in a number of seconds).
1520

1621
`authjwt_cookie_domain`
17-
: is simply dummy text of the printing and typesetting industry
22+
: The domain can be used to specify a domain and subdomain for your cookies.
23+
Defaults to `None` which sets this cookie to only be readable by the domain that set it.
1824

1925
`authjwt_cookie_secure`
20-
: is simply dummy text of the printing and typesetting industry
26+
: If the secure flag is `True` cookie can only be transmitted securely over HTTPS,
27+
and it will not be sent over unencrypted HTTP connections. Defaults to `False`, but in
28+
production this should likely be set to `True`
2129

2230
`authjwt_cookie_samesite`
23-
: is simply dummy text of the printing and typesetting industry
31+
: The browser sends the cookie with both cross-site and same-site requests.
32+
Set to `'lax'` in production to improve protection for CSRF attacks. Defaults to `None`,
33+
which means cookies are always sent through external or internal site.

docs/configuration/csrf.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
`authjwt_cookie_csrf_protect`
2-
: is simply dummy text of the printing and typesetting industry
2+
: Enable/disable CSRF protection when using cookies. Defaults to `True`
33

44
`authjwt_access_csrf_cookie_key`
5-
: is simply dummy text of the printing and typesetting industry
5+
: Key of the CSRF access cookie. Defaults to `'csrf_access_token'`
66

77
`authjwt_refresh_csrf_cookie_key`
8-
: is simply dummy text of the printing and typesetting industry
8+
: Key of the CSRF refresh cookie. Defaults to `'csrf_refresh_token'`
99

1010
`authjwt_access_csrf_cookie_path`
11-
: is simply dummy text of the printing and typesetting industry
11+
: Path for the CSRF access cookie. Defaults to `'/'`
1212

1313
`authjwt_refresh_csrf_cookie_path`
14-
: is simply dummy text of the printing and typesetting industry
14+
: Path for the CSRF refresh cookie. Defaults to `'/'`
1515

1616
`authjwt_access_csrf_header_name`
17-
: is simply dummy text of the printing and typesetting industry
17+
: Name of the header that should contain the CSRF double submit value for access tokens. Defaults to `X-CSRF-TOKEN`
1818

1919
`authjwt_refresh_csrf_header_name`
20-
: is simply dummy text of the printing and typesetting industry
20+
: Name of the header that should contains the CSRF double submit value for refresh tokens. Defaults to `X-CSRF-TOKEN`
2121

2222
`authjwt_csrf_methods`
23-
: is simply dummy text of the printing and typesetting industry
23+
: The request methods that will use CSRF protection. Defaults to `{'POST','PUT','PATCH','DELETE'}`

docs/configuration/denylist.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
`authjwt_denylist_enabled`
2-
: is simply dummy text of the printing and typesetting industry
2+
: Enable/disable token revoking. Defaults to `False`
33

44
`authjwt_denylist_token_checks`
5-
: is simply dummy text of the printing and typesetting industry
5+
: What token types to check against the denylist. The options are `access` or `refresh`.
6+
You can pass in a sequence to check more than one type. Defaults to `{'access', 'refresh'}`.
7+
Only used if deny listing is enabled.

docs/configuration/general.md

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
11
`authjwt_token_location`
2-
: is simply dummy text of the printing and typesetting industry
2+
: Where to look for a JWT when processing a request. The options are `headers` or `cookies`.
3+
You can pass in a sequence to set more than one location `('headers','cookies')`. Defaults to `{'headers'}`
4+
if you pass headers and cookies, headers are precedence.
35

46
`authjwt_secret_key`
5-
: is simply dummy text of the printing and typesetting industry
7+
: The secret key needed for symmetric based signing algorithms, such as `HS*`. Defaults to `None`
68

79
`authjwt_public_key`
8-
: is simply dummy text of the printing and typesetting industry
10+
: The public key needed for asymmetric based signing algorithms, such as `RS*` or `ES*`. PEM format expected.
11+
Defaults to `None`
912

1013
`authjwt_private_key`
11-
: is simply dummy text of the printing and typesetting industry
14+
: The private key needed for asymmetric based signing algorithms, such as `RS*` or `ES*`. PEM format expected.
15+
Defaults to `None`
1216

1317
`authjwt_algorithm`
14-
: is simply dummy text of the printing and typesetting industry
18+
: Which algorithm to sign the JWT with. <a href="https://pyjwt.readthedocs.io/en/latest/algorithms.html">See here</a>
19+
for the options. Defaults to `HS256`
1520

1621
`authjwt_decode_algorithms`
17-
: is simply dummy text of the printing and typesetting industry
22+
: Which algorithms are allowed to decode a JWT. Defaults to a list with only the algorithm set in `authjwt_algorithm`
1823

1924
`authjwt_decode_leeway`
20-
: is simply dummy text of the printing and typesetting industry
25+
: Define the leeway part of the expiration time definition, which means you can validate an expiration
26+
time which is in the past but not very far. Defaults to `0`
2127

2228
`authjwt_encode_issuer`
23-
: is simply dummy text of the printing and typesetting industry
29+
: Define the issuer to set the issuer in JWT claims, only access token have issuer claim. Defaults to `None`
2430

2531
`authjwt_decode_issuer`
26-
: is simply dummy text of the printing and typesetting industry
32+
: Define the issuer to check the issuer in JWT claims, only access token have issuer claim. Defaults to `None`
2733

2834
`authjwt_decode_audience`
29-
: is simply dummy text of the printing and typesetting industry
35+
: The audience or list of audiences you expect in a JWT when decoding it. Defaults to `None`
3036

3137
`authjwt_access_token_expires`
32-
: is simply dummy text of the printing and typesetting industry
38+
: How long an access token should live before it expires. This takes value `integer` *(seconds)* or
39+
`datetime.timedelta`, and defaults to **15 minutes**. Can be set to `False` to disable expiration.
3340

3441
`authjwt_refresh_token_expires`
35-
: is simply dummy text of the printing and typesetting industry
42+
: How long an refresh token should live before it expires. This takes value `integer` *(seconds)* or
43+
`datetime.timedelta`, and defaults to **30 days**. Can be set to `False` to disable expiration.

docs/configuration/headers.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
These are only applicable if `authjwt_token_location` is use headers.
2+
13
`authjwt_header_name`
2-
: is simply dummy text of the printing and typesetting industry
4+
: What header to look for the JWT in a request. Defaults to `Authorization`
35

46
`authjwt_header_type`
5-
: is simply dummy text of the printing and typesetting industry
7+
: What type of header the JWT is in. Defaults to `Bearer`. This can be an empty string,
8+
in which case the header contains only the JWT instead like `HeaderName: Bearer <JWT>`

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ nav:
3434
- Configuration Options:
3535
- General Options: configuration/general.md
3636
- Headers Options: configuration/headers.md
37+
- Denylist Options: configuration/denylist.md
3738
- Cookies Options: configuration/cookies.md
3839
- CSRF Options: configuration/csrf.md
39-
- Denylist Options: configuration/denylist.md

0 commit comments

Comments
 (0)