Skip to content

Commit 8bde1eb

Browse files
committed
document OAS security
1 parent 3068b62 commit 8bde1eb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/api-guide/schemas.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,26 @@ operationIds.
375375
In order to work around this, you can override `get_operation_id_base()` to
376376
provide a different base for name part of the ID.
377377

378+
#### `get_security_schemes()`
379+
380+
Generates the OpenAPI `securitySchemes` components based on:
381+
- Your default `authentication_classes` (`settings.DEFAULT_AUTHENTICATION_CLASSES`)
382+
- Per-view non-default `authentication_classes`
383+
384+
These are generated using the authentication classes' `openapi_security_scheme()` class method. If you
385+
extend `BaseAuthentication` with your own authentication class, you can add this class method to return
386+
the appropriate security scheme object.
387+
388+
#### `get_security_requirements()`
389+
390+
Root-level security requirements (the top-level `security` object) are generated based on the
391+
default authentication classes. Operation-level security requirements are generated only if the given view's
392+
`authentication_classes` differ from the defaults.
393+
394+
These are generated using the authentication classes' `openapi_security_requirement()` class
395+
method. If you extended `BaseAuthentication` with your own authentication class, you can add this
396+
class method to return the appropriate list of security requirements objects.
397+
378398
### `AutoSchema.__init__()` kwargs
379399

380400
`AutoSchema` provides a number of `__init__()` kwargs that can be used for

0 commit comments

Comments
 (0)