connexion.security.flask_security_handler_factory
¶
Module Contents¶
Classes¶
get_*_func -> _get_function -> get_function_from_name (name=security function defined in spec) |
Attributes¶
- connexion.security.flask_security_handler_factory.adapter¶
- connexion.security.flask_security_handler_factory.session¶
- class connexion.security.flask_security_handler_factory.FlaskSecurityHandlerFactory(pass_context_arg_name)¶
Bases:
connexion.security.security_handler_factory.AbstractSecurityHandlerFactory
- get_*_func -> _get_function -> get_function_from_name (name=security function defined in spec)
(if url defined instead of a function -> get_token_info_remote)
std security functions: security_{passthrough,deny}
- verify_* -> returns a security wrapper around the security function
- check_* -> returns a function tasked with doing auth for use inside the verify wrapper
check helpers (used outside wrappers): _need_to_add_context_or_scopes the security function
verify helpers (used inside wrappers): get_auth_header_value, get_cookie_value
- no_value¶
- required_scopes_kw = required_scopes¶
- __slots__ = []¶
- get_token_info_remote(self, token_info_url)¶
Return a function which will call token_info_url to retrieve token info.
Returned function must accept oauth token in parameter. It must return a token_info dict in case of success, None otherwise.
- Parameters
token_info_url (str) – Url to get information about the token
- Return type
types.FunctionType
- get_tokeninfo_func(self, security_definition: dict) → Optional[Callable]¶
- classmethod get_scope_validate_func(cls, security_definition)¶
- Return type
function
>>> get_scope_validate_func({'x-scopeValidateFunc': 'foo.bar'}) '<function foo.bar>'
- classmethod get_basicinfo_func(cls, security_definition)¶
- Return type
function
>>> get_basicinfo_func({'x-basicInfoFunc': 'foo.bar'}) '<function foo.bar>'
- classmethod get_apikeyinfo_func(cls, security_definition)¶
- Return type
function
>>> get_apikeyinfo_func({'x-apikeyInfoFunc': 'foo.bar'}) '<function foo.bar>'
- classmethod get_bearerinfo_func(cls, security_definition)¶
- Return type
function
>>> get_bearerinfo_func({'x-bearerInfoFunc': 'foo.bar'}) '<function foo.bar>'
- static security_passthrough(function)¶
- Return type
types.FunctionType
- static security_deny(function)¶
- Return type
types.FunctionType
- static validate_scope(required_scopes, token_scopes)¶
- Parameters
required_scopes – Scopes required to access operation
token_scopes – Scopes granted by authorization server
- Return type
bool
- static get_auth_header_value(request)¶
Called inside security wrapper functions
Return Authorization type and value if any. If not Authorization, return (None, None) Raise OAuthProblem for invalid Authorization header
- verify_oauth(self, token_info_func, scope_validate_func)¶
- verify_basic(self, basic_info_func)¶
- static get_cookie_value(cookies, name)¶
Called inside security wrapper functions
Returns cookie value by its name. None if no such value. :param cookies: str: cookies raw data :param name: str: cookies key
- verify_api_key(self, api_key_info_func, loc, name)¶
- verify_bearer(self, token_info_func)¶
- Parameters
token_info_func – types.FunctionType
- Return type
types.FunctionType
- static verify_none()¶
- Return type
types.FunctionType
- check_bearer_token(self, token_info_func)¶
- check_basic_auth(self, basic_info_func)¶
- check_api_key(self, api_key_info_func)¶
- check_oauth_func(self, token_info_func, scope_validate_func)¶
- classmethod verify_security(cls, auth_funcs, required_scopes, function)¶