def _get_lti_1p3_consumer(self): """ Return a class of LTI 1.3 consumer. Uses the `config_store` variable to determine where to look for the configuration and instance the class. """ # If LTI configuration is stored in the XBlock. if self.config_store == self.CONFIG_ON_XBLOCK: consumer = LtiConsumer1p3( iss=get_lms_base(), lti_oidc_url=self.block.lti_1p3_oidc_url, lti_launch_url=self.block.lti_1p3_launch_url, client_id=self.block.lti_1p3_client_id, # Deployment ID hardcoded to 1 since # we're not using multi-tenancy. deployment_id="1", # XBlock Private RSA Key rsa_key=self.block.lti_1p3_block_key, rsa_key_id=self.block.lti_1p3_client_id, # LTI 1.3 Tool key/keyset url tool_key=self.block.lti_1p3_tool_public_key, tool_keyset_url=None, ) return consumer # There's no configuration stored locally, so throw # NotImplemented. raise NotImplementedError
def _get_lti_1p3_consumer(self): """ Return a class of LTI 1.3 consumer. Uses the `config_store` variable to determine where to look for the configuration and instance the class. """ # If LTI configuration is stored in the XBlock. if self.config_store == self.CONFIG_ON_XBLOCK: consumer = LtiAdvantageConsumer( iss=get_lms_base(), lti_oidc_url=self.block.lti_1p3_oidc_url, lti_launch_url=self.block.lti_1p3_launch_url, client_id=self.lti_1p3_client_id, # Deployment ID hardcoded to 1 since # we're not using multi-tenancy. deployment_id="1", # XBlock Private RSA Key rsa_key=self.lti_1p3_private_key, rsa_key_id=self.lti_1p3_private_key_id, # LTI 1.3 Tool key/keyset url tool_key=self.block.lti_1p3_tool_public_key, tool_keyset_url=None, ) # Check if enabled and setup LTI-AGS if self.block.has_score: default_values = { 'resource_id': self.block.location, 'score_maximum': self.block.weight, 'label': self.block.display_name, } if hasattr(self.block, 'start'): default_values['start_date_time'] = self.block.start if hasattr(self.block, 'due'): default_values['end_date_time'] = self.block.due # create LineItem if there is none for current lti configuration lineitem, _ = LtiAgsLineItem.objects.get_or_create( lti_configuration=self, resource_link_id=self.block.location, defaults=default_values) consumer.enable_ags( lineitems_url=get_lti_ags_lineitems_url(self.id), lineitem_url=get_lti_ags_lineitems_url( self.id, lineitem.id), ) return consumer # There's no configuration stored locally, so throw # NotImplemented. raise NotImplementedError
def _get_lti_1p3_consumer(self): """ Return a class of LTI 1.3 consumer. Uses the `config_store` variable to determine where to look for the configuration and instance the class. """ # If LTI configuration is stored in the XBlock. if self.config_store == self.CONFIG_ON_XBLOCK: consumer = LtiAdvantageConsumer( iss=get_lms_base(), lti_oidc_url=self.block.lti_1p3_oidc_url, lti_launch_url=self.block.lti_1p3_launch_url, client_id=self.lti_1p3_client_id, # Deployment ID hardcoded to 1 since # we're not using multi-tenancy. deployment_id="1", # XBlock Private RSA Key rsa_key=self.lti_1p3_private_key, rsa_key_id=self.lti_1p3_private_key_id, # LTI 1.3 Tool key/keyset url tool_key=self.block.lti_1p3_tool_public_key, tool_keyset_url=self.block.lti_1p3_tool_keyset_url, ) # Check if enabled and setup LTI-AGS if self.block.lti_advantage_ags_mode != 'disabled': lineitem = None # If using the declarative approach, we should create a LineItem if it # doesn't exist. This is because on this mode the tool is not able to create # and manage lineitems using the AGS endpoints. if self.block.lti_advantage_ags_mode == 'declarative': # Set grade attributes default_values = { 'resource_id': self.block.location, 'score_maximum': self.block.weight, 'label': self.block.display_name, } if hasattr(self.block, 'start'): default_values['start_date_time'] = self.block.start if hasattr(self.block, 'due'): default_values['end_date_time'] = self.block.due # create LineItem if there is none for current lti configuration lineitem, _ = LtiAgsLineItem.objects.get_or_create( lti_configuration=self, resource_link_id=self.block.location, defaults=default_values) consumer.enable_ags( lineitems_url=get_lti_ags_lineitems_url(self.id), lineitem_url=get_lti_ags_lineitems_url( self.id, lineitem.id) if lineitem else None, allow_programmatic_grade_interaction=( self.block.lti_advantage_ags_mode == 'programmatic')) # Check if enabled and setup LTI-DL if self.block.lti_advantage_deep_linking_enabled: consumer.enable_deep_linking( self.block.lti_advantage_deep_linking_launch_url, get_lti_deeplinking_response_url(self.id), ) # Check if enabled and setup LTI-NRPS if self.block.lti_1p3_enable_nrps: consumer.enable_nrps( get_lti_nrps_context_membership_url(self.id)) return consumer # There's no configuration stored locally, so throw # NotImplemented. raise NotImplementedError