Exemplo n.º 1
0
    private function check_signature($consumerkey, $secret, $body) {

        $ok = true;
        try {
            // TODO: Switch to core oauthlib once implemented - MDL-30149.
            lti\handle_oauth_body_post($consumerkey, $secret, $body);
        } catch (Exception $e) {
            debugging($e->getMessage() . "\n");
            $ok = false;
        }

        return $ok;

    }
Exemplo n.º 2
0
function lti_verify_message($key, $sharedsecrets, $body, $headers = null)
{
    foreach ($sharedsecrets as $secret) {
        $signaturefailed = false;
        try {
            // TODO: Switch to core oauthlib once implemented - MDL-30149.
            lti\handle_oauth_body_post($key, $secret, $body, $headers);
        } catch (Exception $e) {
            $signaturefailed = true;
        }
        if (!$signaturefailed) {
            return $secret;
            // Return the secret used to sign the message).
        }
    }
    return false;
}