def validate_token_and_source(token_in_headers, token_in_query_params):
    """
    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: TokenDB object on success.
    :rtype: :class:`.TokenDB`
    """
    if not token_in_headers and not token_in_query_params:
        LOG.audit("Token is not found in header or query parameters.")
        raise exceptions.TokenNotProvidedError("Token is not provided.")

    if token_in_headers:
        LOG.audit("Token provided in headers")

    if token_in_query_params:
        LOG.audit("Token provided in query parameters")

    return validate_token(token_in_headers or token_in_query_params)

    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: TokenDB object on success.
    :rtype: :class:`.TokenDB`
    
st2common/st2common/util/auth.py