API Reference¶
LTI Views¶
- lti_tool.views.jwks(request)¶
Makes a JWKS available to LTI platforms.
- class lti_tool.views.OIDCLoginInitView(**kwargs)¶
Handles OIDC 3rd-party login initiation for an LTI launch.
- get_redirect_url(target_link_uri: str) str¶
Returns the redirect_uri to use for the OIDC initiation response.
- class lti_tool.views.LtiLaunchBaseView(**kwargs)¶
Base view for handling LTI 1.3 launches.
Inherit from this view and implement the handle_resource_launch method. Other message types can be handled as well by overriding the appropriate method.
- get_lti1p1_secret(oauth_consumer_key: str | None) str | None¶
Returns the LTI 1.1 secret for the provided consumer key.
Override this method to validate and sync data from the LTI 1.1 migration claim.
- handle_inactive_deployment(request: HttpRequest, lti_launch: LtiLaunch) HttpResponse¶
Handles LTI launches with inactive deployments.
- handle_resource_launch(request: HttpRequest, lti_launch: LtiLaunch) HttpResponse¶
Handles an LTI resource launch.
Implement this method to handle LTI resource link launch requests, as described in the LTI 1.3 core spec at https://www.imsglobal.org/spec/lti/v1p3/#resource-link-launch-request-message
LTI launch data¶
When using django-lti, LTI launch data is accessed through the LtiLaunch class.
- class lti_tool.models.LtiLaunch(message_launch: MessageLaunch)¶
An LTI launch.
- property context: LtiContext¶
The LTI context associated with the launch.
- deep_link_response(resources: list[DeepLinkResource]) HttpResponse¶
Creates a deep linking response for this launch.
- property deployment: LtiDeployment¶
The LTI deployment associated with this launch.
- property dimensions: ViewportDimensions | None¶
Width and height of the window or frame in which the launch is presented.
See https://www.imsglobal.org/spec/lti/v1p3/#launch-presentation-claim
- property document_target: str | None¶
The kind of browser window or frame in which the launch is presented.
See https://www.imsglobal.org/spec/lti/v1p3/#launch-presentation-claim
- get_custom_claim(claim: str) str | None¶
Returns a custom claim value, or None if not present.
- get_return_url(*, lti_errormsg: str = '', lti_msg: str = '', lti_errorlog: str = '', lti_log: str = '') str | None¶
Constructs a return URL, when supported by the launch.
- has_valid_migration_claim(lti1p1_secret: str) bool¶
Indicates if the launch has a valid LTI 1.1 migration claim.
- property is_absent: bool¶
- property is_data_privacy_launch: bool¶
Indicates if the launch is a data privacy launch request.
- property is_deep_link_launch: bool¶
Indicates if the launch is a deep linking request.
- property is_present: bool¶
- property is_resource_launch: bool¶
Indicates if the launch is resource link launch request.
- property is_submission_review_launch: bool¶
Indicates if the launch is a submission review request.
- property lti1p1_consumer_key¶
- property membership: LtiMembership¶
The LTI membership associated with the launch.
- property migration_claim¶
- property platform_instance: LtiPlatformInstance | None¶
The LTI platform instance associated with the launch, if present.
- property registration: LtiRegistration¶
The LTI platform registration associated with this launch.
- property resource_link: LtiResourceLink¶
The LTI resource link associated with the launch.
- property user: LtiUser¶
The LTI user associated with the launch.
For requests in a non-LTI conext, an AbsentLtiLaunch will be present.
LTI Models¶
Django database models are provided by django-lti to represent the configuration
and components of an LTI launch.
- class lti_tool.models.LtiRegistration(*args, **kwargs)¶
An LTI platform registration.
- name¶
A display name for this registration
- Type:
str
- uuid¶
A unique identifier for registraitons for use in OIDC login init.
- Type:
uuid4
- issuer¶
The platform’s issuer.
- Type:
str
- client_id¶
The client ID assigned to the tool by the platform.
- Type:
str
- audience¶
The platforms’s OAuth2 audience.
- Type:
str
- auth_url¶
The platform’s auth login URL.
- Type:
str
- token_url¶
The platform’s access token retrieval URL.
- Type:
str
- keyset_url¶
The platform’s JWKS URL.
- Type:
str
- is_active¶
Indicates if the registration is active within the tool.
- Type:
bool
- public_key¶
Public key data specific to this registration. Only to be used when the platform cannot retrieve keys from a tool’s JWKS URL.
- Type:
str
- private_key¶
Private key data specific to this registration. Only to be used when the platform cannot retrieve keys from a tool’s JWKS URL.
- Type:
str
- datetime_created¶
When the registration was created.
- Type:
datetime
- datetime_modified¶
When the registration was last modified.
- Type:
datetime
- property has_key¶
Indicates if the registration has an assigned keypair.
- Type:
bool