1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
---
hide:
- navigation
---
# Security
Openapi-core provides easy access to security data for authentication and authorization processes.
Supported security schemes:
- http – for Basic and Bearer HTTP authentication schemes
- apiKey – for API keys and cookie authentication
Here's an example with `BasicAuth` and `ApiKeyAuth` security schemes:
```yaml
security:
- BasicAuth: []
- ApiKeyAuth: []
components:
securitySchemes:
BasicAuth:
type: http
scheme: basic
ApiKeyAuth:
type: apiKey
in: header
name: X-API-Key
```
Security scheme data is accessible from the `security` attribute of the `RequestUnmarshalResult` object.
```python
# Get basic auth decoded credentials
result.security['BasicAuth']
# Get API key
result.security['ApiKeyAuth']
```
|