mirror of
https://github.com/correl/openapi-core.git
synced 2024-11-24 19:19:56 +00:00
19 lines
498 B
Python
19 lines
498 B
Python
from openapi_core.security.providers import (
|
|
ApiKeyProvider, HttpProvider, UnsupportedProvider,
|
|
)
|
|
|
|
|
|
class SecurityProviderFactory(object):
|
|
|
|
PROVIDERS = {
|
|
'apiKey': ApiKeyProvider,
|
|
'http': HttpProvider,
|
|
}
|
|
|
|
def create(self, scheme):
|
|
scheme_type = scheme['type']
|
|
if scheme_type == 'apiKey':
|
|
return ApiKeyProvider(scheme)
|
|
elif scheme_type == 'http':
|
|
return HttpProvider(scheme)
|
|
return UnsupportedProvider(scheme)
|