OIDC Initiation#
LTI launches use the OIDC third-party initiation flow as a security measure to prevent CSRF attacks. As a part of this workflow, an LTI tool must:
Receive an initiation request from a registered platform.
Respond with a properly formed authentication request.
Handling an initiation request#
To handle an initiation request from an LTI platform, django-lti
provides
OIDCLoginInitView
, which can be used as-is in a Django project
to return an authentication request to the platform
# ...
from lti_tool.views import OIDCLoginInitView
urlpatterns = [
path("init/<uuid:registration_uuid/", OIDCLoginInitView.as_view(), name="init"),
# ...
]
The registration_uuid
parameter is a reference to the
LtiRegistration.uuid
property, and is
used to identify the platform registration associated with the initiation request.
Customizing the authentication request#
By default, the response from OIDCLoginInitView
will use the
target_link_uri
from the request as the redirect_uri
. If the application
requires the use of a different redirect_uri
it can be provided by overriding the
get_redirect_url()
method.
class CustomLoginInitView(OIDCLoginInitView):
def get_redirect_url(self, target_link_uri):
return "https://my.tool/some/custom/path/"
Resources#
OpenID Connect Launch Flow Overview described in the 1EdTech Security Framework.
Additional login parameters described by the LTI 1.3 Core Specification.
LTI 1.3 Security and OpenID Connect explains the CSRF vulnerability that is addressed by the third-party initiation flow.