Decorators
application_kit.django.decorators
permissions_classes
module-attribute
permissions_classes = cast(
PermissionsClassesProtocol, _PermissionClasses
)
Original authentication decorator, use authenticate_key or authenticate_user.
authenticate_key
module-attribute
authenticate_key = cast(
AuthenticateKeyProtocol,
partial(
_PermissionClasses,
classes=[],
token_lambda=partial(
get_authorization_token,
[PUBLIC_KEY, PRIVATE_KEY],
),
),
)
The decorator to authenticate a request with a key.
authenticate_user
module-attribute
authenticate_user = cast(
AuthenticateUserProtocol,
partial(
_PermissionClasses,
token_lambda=partial(
get_authorization_token, [USER_TOKEN]
),
),
)
The decorator to authenticate users.
ProjectLambda
Bases: Protocol
__call__
__call__(get, meta)
Project lambda protocol definition.
Source code in application_kit/django/decorators.py
36 37 | |
CounterNameLambda
Bases: Protocol
__call__
__call__(product, key, key_kind, **kwargs)
Counter name lambda protocol definition.
Source code in application_kit/django/decorators.py
41 42 | |
OrganizationLambda
Bases: Protocol
__call__
__call__(token, query_args)
Organization lambda protocol definition.
Source code in application_kit/django/decorators.py
46 47 | |
PermissionsClassesProtocol
Bases: Protocol
__call__
__call__(classes, token_lambda=None, product=None)
Historic way of authenticating a view.
Supersed by authenticate_key, authenticate_user
| PARAMETER | DESCRIPTION |
|---|---|
classes
|
A list of CheckablePermissions to execute on the request.
TYPE:
|
token_lambda
|
The function to extract an authentication credential from request parameters and headers.
TYPE:
|
product
|
The products required by the endpoint.
TYPE:
|
Source code in application_kit/django/decorators.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
AuthenticateKeyProtocol
Bases: Protocol
__call__
__call__(
product=None,
write_permission_needed=False,
endpoint_mode=UNSET,
)
Authenticates a request with a public or a private key.
| PARAMETER | DESCRIPTION |
|---|---|
product
|
The product required by the authenticate_key call. Warning If None is used, the default product set in the settings
TYPE:
|
write_permission_needed
|
Deprecated Use endpoint_mode instead.
TYPE:
|
endpoint_mode
|
Controls how the permissions should be considered for a request.
TYPE:
|
Source code in application_kit/django/decorators.py
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 | |
AuthenticateUserProtocol
Bases: Protocol
__call__
__call__(classes, product=None)
PermissionsClassesProtocol
| PARAMETER | DESCRIPTION |
|---|---|
product
|
The product required by the authenticate_user call. Note If None is used, the default product set in the settings
TYPE:
|
Source code in application_kit/django/decorators.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
count_request
count_request(request_name, product, name_lambda=None)
Counts the request, must be placed after authenticate_key or authenticate_user decorator.
Source code in application_kit/django/decorators.py
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 | |