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.

launch_setup(request: HttpRequest, lti_launch: LtiLaunch) None#
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

handle_deep_linking_launch(request: HttpRequest, lti_launch: LtiLaunch) HttpResponse#
handle_submission_review_launch(request: HttpRequest, lti_launch: LtiLaunch) HttpResponse#
handle_data_privacy_launch(request: HttpRequest, lti_launch: LtiLaunch) HttpResponse#

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.

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.

property is_absent: bool#
property is_data_privacy_launch: bool#

Indicates if the launch is a data privacy launch request.

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 membership: LtiMembership#

The LTI membership associated with the launch.

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.

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.

class lti_tool.models.AbsentLtiLaunch#

Placeholder for non-LTI launch contexts.

property is_absent: bool#
property is_present: bool#

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

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 specifc 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 specifc 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