@ Override public LtiVerificationResult verify ( HttpServletRequest request , String secret ) throws LtiVerificationException { OAuthMessage oam = OAuthServlet . getMessage ( request , OAuthServlet . getRequestURL ( request ) ) ; String oauth_consumer_key = null ; try { oauth_consumer_key = oam . getConsumerKey ( ) ; } catch ( Exception e ) { return new LtiVerificationResult ( false , LtiError . BAD_REQUEST , "Unable to find consumer key in message" ) ; } OAuthValidator oav = new SimpleOAuthValidator ( ) ; OAuthConsumer cons = new OAuthConsumer ( null , oauth_consumer_key , secret , null ) ; OAuthAccessor acc = new OAuthAccessor ( cons ) ; try { oav . validateMessage ( oam , acc ) ; } catch ( Exception e ) { return new LtiVerificationResult ( false , LtiError . BAD_REQUEST , "Failed to validate: " + e . getLocalizedMessage ( ) ) ; } return new LtiVerificationResult ( true , new LtiLaunch ( request ) ) ; }
This method verifies the signed HttpServletRequest