use of org.imsglobal.lti.launch.LtiOauthVerifier 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;
}
Aggregations