SimpleJWTExtension
class¶
esmerald_simple_jwt.extension.SimpleJWTExtension
¶
SimpleJWTExtension(app=None, **kwargs)
Bases: Extension
The pluggable version of Esmerald Simple JWT.
This Pluggable can and should be used if you want to add the package independently as a ChilEsmerald.
Example
from esmerald import Esmerald, Pluggable
from esmerald_simple_jwt.extension import SimpleJWTExtension
app = Esmerald(
pluggables={
"simple-jwt": Pluggable(SimpleJWTExtension, path="/auth"),
},
)
PARAMETER | DESCRIPTION |
---|---|
app |
TYPE:
|
**kwargs |
TYPE:
|
Source code in esmerald_simple_jwt/extension.py
38 39 40 41 |
|
extend
¶
extend(path='/simple-jwt', name=None, settings_module=None, middleware=None, dependencies=None, exception_handlers=None, interceptors=None, permissions=None, include_in_schema=True, enable_openapi=True)
The extend() default from the Pluggable interface allowing to pass extra parameters to the initialisation.
Example
from esmerald import Esmerald, Pluggable
from esmerald_simple_jwt.extension import SimpleJWTExtension
app = Esmerald(
pluggables={
"simple-jwt": Pluggable(
SimpleJWTExtension,
path="/auth",
settings_module=...,
middleware=...,
permissions=...,
interceptors=...,
),
},
)
PARAMETER | DESCRIPTION |
---|---|
path |
Relative path of the Plugable.
The path can contain parameters in a dictionary like format
and if the path is not provided, it will default to Example
TYPE:
|
name |
The name for the Gateway. The name can be reversed by
TYPE:
|
settings_module |
Alternative settings parameter. This parameter is an alternative to
When the Read more about the settings module and how you can leverage it in your application. Tip The settings module can be very useful if you want to have, for example, a ChildEsmerald that needs completely different settings from the main app. Example: A
TYPE:
|
middleware |
A list of middleware to run for every request. The middlewares of a Gateway will be checked from top-down or Starlette Middleware as they are both converted internally. Read more about Python Protocols.
TYPE:
|
dependencies |
A dictionary of string and Inject instances enable application level dependency injection.
TYPE:
|
exception_handlers |
A dictionary of exception types (or custom exceptions) and the handler functions on an application top level. Exception handler callables should be of the form of
TYPE:
|
interceptors |
A list of interceptors to serve the application incoming requests (HTTP and Websockets).
TYPE:
|
permissions |
A list of permissions to serve the application incoming requests (HTTP and Websockets).
TYPE:
|
include_in_schema |
Boolean flag indicating if it should be added to the OpenAPI docs.
TYPE:
|
enable_openapi |
Boolean flag indicating if the OpenAPI documentation should be generated or not. When Tip Disable this option if you run in production and no one should access the documentation unless behind an authentication. ```
TYPE:
|
Source code in esmerald_simple_jwt/extension.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|