Search in sources :

Example 1 with LtiVerificationException

use of org.imsglobal.lti.launch.LtiVerificationException in project ArTEMiS by ls1intum.

the class LtiService method verifyRequest.

/**
 * Checks if a LTI request is correctly signed via OAuth with the secret
 *
 * @param request The request to check
 * @return True if the request is valid, otherwise false
 */
public Boolean verifyRequest(HttpServletRequest request) {
    LtiVerifier ltiVerifier = new LtiOauthVerifier();
    Boolean success = false;
    try {
        LtiVerificationResult ltiResult = ltiVerifier.verify(request, this.OAUTH_SECRET);
        success = ltiResult.getSuccess();
        if (!success) {
            log.error("Lti signature verification failed: " + ltiResult.getMessage());
        }
    } catch (LtiVerificationException e) {
        log.error("Lti signature verification failed. ", e);
    }
    return success;
}
Also used : LtiVerificationResult(org.imsglobal.lti.launch.LtiVerificationResult) LtiVerificationException(org.imsglobal.lti.launch.LtiVerificationException) LtiOauthVerifier(org.imsglobal.lti.launch.LtiOauthVerifier) LtiVerifier(org.imsglobal.lti.launch.LtiVerifier)

Aggregations

LtiOauthVerifier (org.imsglobal.lti.launch.LtiOauthVerifier)1 LtiVerificationException (org.imsglobal.lti.launch.LtiVerificationException)1 LtiVerificationResult (org.imsglobal.lti.launch.LtiVerificationResult)1 LtiVerifier (org.imsglobal.lti.launch.LtiVerifier)1