'Validates LTI signature and returns LTI parameters'

@classmethod
def _get_validated_lti_params_from_values(cls, request, current_time, lti_consumer_valid, lti_consumer_secret, lti_max_timestamp_age):

    try:
        base_uri = normalize_base_string_uri(request.uri)
        parameters = collect_parameters(uri_query=request.uri_query, body=request.body)
        parameters_string = normalize_parameters(parameters)
        base_string = construct_base_string(request.http_method, base_uri, parameters_string)
        computed_signature = sign_hmac_sha1(base_string, unicode(lti_consumer_secret), '')
        submitted_signature = request.oauth_signature
        data = {parameter_value_pair[0]: parameter_value_pair[1] for parameter_value_pair in parameters}
        def safe_int(value):
            '\n                                                                Interprets    parameter    as    an    int    or    returns    0    if    not    possible\n                                                                '
            try:
                return int(value)
            except (ValueError, TypeError):
                return 0
        oauth_timestamp = safe_int(request.oauth_timestamp)
        valid = lti_consumer_valid
        valid = (valid & (submitted_signature == computed_signature))
        valid = (valid & (request.oauth_version == '1.0'))
        valid = (valid & (request.oauth_signature_method == 'HMAC-SHA1'))
        valid = (valid & ('user_id' in data))
        valid = (valid & (oauth_timestamp >= (current_time - lti_max_timestamp_age)))
        valid = (valid & (oauth_timestamp <= current_time))
        if valid:
            return data
    except AttributeError as error:
        log.error("'{}'    not    found.".format(error.message))
    return None
