You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.rst
+42
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,9 @@ and unmarshal request data from validation result
78
78
# get body
79
79
validated_body = result.body
80
80
81
+
# get security data
82
+
validated_security = result.security
83
+
81
84
Request object should be instance of OpenAPIRequest class (See `Integrations`_).
82
85
83
86
Response
@@ -110,6 +113,45 @@ and unmarshal response data from validation result
110
113
111
114
Response object should be instance of OpenAPIResponse class (See `Integrations`_).
112
115
116
+
Security
117
+
********
118
+
119
+
openapi-core supports security for authentication and authorization process. Security data for security schemas are accessible from `security` attribute of `RequestValidationResult` object.
120
+
121
+
For given security specification:
122
+
123
+
.. code-block:: yaml
124
+
125
+
security:
126
+
- BasicAuth: []
127
+
- ApiKeyAuth: []
128
+
components:
129
+
securitySchemes:
130
+
BasicAuth:
131
+
type: http
132
+
scheme: basic
133
+
ApiKeyAuth:
134
+
type: apiKey
135
+
in: header
136
+
name: X-API-Key
137
+
138
+
you can access your security data the following:
139
+
140
+
.. code-block:: python
141
+
142
+
result = validator.validate(request)
143
+
144
+
# get basic auth decoded credentials
145
+
result.security['BasicAuth']
146
+
147
+
# get api key
148
+
result.security['ApiKeyAuth']
149
+
150
+
Supported security types:
151
+
152
+
* http – for Basic and Bearer HTTP authentications schemes
0 commit comments