@csrf_exempt
@add_p3p_header
def lti_launch(request, course_id, usage_id):
 if (not settings.FEATURES['ENABLE_LTI_PROVIDER']):
  return HttpResponseForbidden()
 params = get_required_parameters(request.POST)
 if (not params):
  return HttpResponseBadRequest()
 params.update(get_optional_parameters(request.POST))
 try:
  lti_consumer = LtiConsumer.get_or_supplement(params.get('tool_consumer_instance_guid', None), params['oauth_consumer_key'])
 except LtiConsumer.DoesNotExist:
  return HttpResponseForbidden()
 if (not SignatureValidator(lti_consumer).verify(request)):
  return HttpResponseForbidden()
 try:
  (course_key, usage_key) = parse_course_and_usage_keys(course_id, usage_id)
 except InvalidKeyError:
  log.error('Invalid course key %s or usage key %s from request %s', course_id, usage_id, request)
  raise Http404()
 params['course_key'] = course_key
 params['usage_key'] = usage_key
 authenticate_lti_user(request, params['user_id'], lti_consumer)
 store_outcome_parameters(params, request.user, lti_consumer)
 return render_courseware(request, params['usage_key'])

@ csrf_exempt @ add_p3p_header def lti_launch ( request , course_id , usage_id ) : if ( not settings . FEATURES [ 'ENABLE_LTI_PROVIDER' ] ) : return HttpResponseForbidden ( ) params = get_required_parameters ( request . POST ) if ( not params ) : return HttpResponseBadRequest ( ) params . update ( get_optional_parameters ( request . POST ) ) try : lti_consumer = LtiConsumer . get_or_supplement ( params . get ( 'tool_consumer_instance_guid' , None ) , params [ 'oauth_consumer_key' ] ) except LtiConsumer . DoesNotExist : return HttpResponseForbidden ( ) if ( not SignatureValidator ( lti_consumer ) . verify ( request ) ) : return HttpResponseForbidden ( ) try : ( course_key , usage_key ) = parse_course_and_usage_keys ( course_id , usage_id ) except InvalidKeyError : log . error ( 'Invalid course key %s or usage key %s from request %s' , course_id , usage_id , request ) raise Http404 ( ) params [ 'course_key' ] = course_key params [ 'usage_key' ] = usage_key authenticate_lti_user ( request , params [ 'user_id' ] , lti_consumer ) store_outcome_parameters ( params , request . user , lti_consumer ) return render_courseware ( request , params [ 'usage_key' ] )
endpoint for all requests to embed edx content via the lti protocol .