Validate the provided authentication token. :param token_in_headers: Authentication token provided via headers. :type token_in_headers: ``str`` :param token_in_query_params: Authentication token provided via query params. :type token_in_query_params: ``str`` :return: Toke
(token_in_headers, token_in_query_params)
| 61 | |
| 62 | |
| 63 | def validate_token_and_source(token_in_headers, token_in_query_params): |
| 64 | """ |
| 65 | Validate the provided authentication token. |
| 66 | |
| 67 | :param token_in_headers: Authentication token provided via headers. |
| 68 | :type token_in_headers: ``str`` |
| 69 | |
| 70 | :param token_in_query_params: Authentication token provided via query params. |
| 71 | :type token_in_query_params: ``str`` |
| 72 | |
| 73 | :return: TokenDB object on success. |
| 74 | :rtype: :class:`.TokenDB` |
| 75 | """ |
| 76 | if not token_in_headers and not token_in_query_params: |
| 77 | LOG.audit("Token is not found in header or query parameters.") |
| 78 | raise exceptions.TokenNotProvidedError("Token is not provided.") |
| 79 | |
| 80 | if token_in_headers: |
| 81 | LOG.audit("Token provided in headers") |
| 82 | |
| 83 | if token_in_query_params: |
| 84 | LOG.audit("Token provided in query parameters") |
| 85 | |
| 86 | return validate_token(token_in_headers or token_in_query_params) |
| 87 | |
| 88 | |
| 89 | def generate_api_key(): |
nothing calls this directly
no test coverage detected