Lti_1p3.ToolDataProvider behaviour (Lti 1p3 v0.3.0)

Link to this section Summary

Callbacks

Creates or updates the LTI params for a user, keying off the 'key' value.

Gets the deployment associated with the given registration and deployment_id.

Gets the jwk associated with the given Registration.

Gets the LTI params associated with a user from the cache using the given key.

Gets the registration associated with the given issuer and client_id.

Gets the registration and deployment associated with the given issuer, client_id and deployment_id.

Link to this section Callbacks

Link to this callback

create_deployment(%Lti_1p3.Tool.Deployment{})

Specs

create_deployment(%Lti_1p3.Tool.Deployment{
  deployment_id: term(),
  id: term(),
  registration_id: term()
}) ::
  {:ok,
   %Lti_1p3.Tool.Deployment{
     deployment_id: term(),
     id: term(),
     registration_id: term()
   }}
  | {:error, DataProviderError.t()}

Creates a new deployment.

Examples

iex> create_deployment(%Deployment{})
{:ok, %Deployment{}}
iex> create_deployment(%Deployment{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback

create_or_update_lti_params(%Lti_1p3.Tool.LtiParams{})

Specs

create_or_update_lti_params(%Lti_1p3.Tool.LtiParams{
  exp: term(),
  id: term(),
  key: term(),
  params: term()
}) ::
  {:ok,
   %Lti_1p3.Tool.LtiParams{exp: term(), id: term(), key: term(), params: term()}}
  | {:error, DataProviderError.t()}

Creates or updates the LTI params for a user, keying off the 'key' value.

Examples

iex> create_or_update_lti_params(%LtiParams{})
{:ok, %LtiParams{}}
iex> create_or_update_lti_params(%LtiParams{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback

create_registration(%Lti_1p3.Tool.Registration{})

Specs

create_registration(%Lti_1p3.Tool.Registration{
  auth_login_url: term(),
  auth_server: term(),
  auth_token_url: term(),
  client_id: term(),
  id: term(),
  issuer: term(),
  key_set_url: term(),
  tool_jwk_id: term()
}) ::
  {:ok,
   %Lti_1p3.Tool.Registration{
     auth_login_url: term(),
     auth_server: term(),
     auth_token_url: term(),
     client_id: term(),
     id: term(),
     issuer: term(),
     key_set_url: term(),
     tool_jwk_id: term()
   }}
  | {:error, DataProviderError.t()}

Creates a new registration.

Examples

iex> create_registration(%Registration{})
{:ok, %Registration{}}
iex> create_registration(%Registration{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback

get_deployment(%Lti_1p3.Tool.Registration{}, arg2)

Specs

get_deployment(
  %Lti_1p3.Tool.Registration{
    auth_login_url: term(),
    auth_server: term(),
    auth_token_url: term(),
    client_id: term(),
    id: term(),
    issuer: term(),
    key_set_url: term(),
    tool_jwk_id: term()
  },
  String.t()
) ::
  %Lti_1p3.Tool.Deployment{
    deployment_id: term(),
    id: term(),
    registration_id: term()
  }
  | nil

Gets the deployment associated with the given registration and deployment_id.

Examples

iex> get_deployment(%Registration{}, deployment_id)
%Deployment{}
iex> get_deployment(%Registration{}, deployment_id)
nil
Link to this callback

get_jwk_by_registration(%Lti_1p3.Tool.Registration{})

Specs

get_jwk_by_registration(%Lti_1p3.Tool.Registration{
  auth_login_url: term(),
  auth_server: term(),
  auth_token_url: term(),
  client_id: term(),
  id: term(),
  issuer: term(),
  key_set_url: term(),
  tool_jwk_id: term()
}) ::
  {:ok,
   %Lti_1p3.Jwk{
     active: term(),
     alg: term(),
     id: term(),
     kid: term(),
     pem: term(),
     typ: term()
   }}
  | {:error, DataProviderError.t()}

Gets the jwk associated with the given Registration.

Examples

iex> get_jwk_by_registration(%Registration{})
{:ok, %Jwk{}}
iex> get_jwk_by_registration(%Registration{})
{:error, %Lti_1p3.DataProviderError{}}
Link to this callback

get_lti_params_by_key(arg1)

Specs

get_lti_params_by_key(String.t()) ::
  %Lti_1p3.Tool.LtiParams{exp: term(), id: term(), key: term(), params: term()}
  | nil

Gets the LTI params associated with a user from the cache using the given key.

Examples

iex> get_lti_params_by_key(key)
 %LtiParams{}
iex> get_lti_params_by_key(key)
nil
Link to this callback

get_registration_by_issuer_client_id(arg1, arg2)

Specs

get_registration_by_issuer_client_id(String.t(), String.t()) ::
  %Lti_1p3.Tool.Registration{
    auth_login_url: term(),
    auth_server: term(),
    auth_token_url: term(),
    client_id: term(),
    id: term(),
    issuer: term(),
    key_set_url: term(),
    tool_jwk_id: term()
  }
  | nil

Gets the registration associated with the given issuer and client_id.

Examples

iex> get_registration_by_issuer_client_id(issuer, client_id)
%Registration{}
iex> get_registration_by_issuer_client_id(issuer, client_id)
nil
Link to this callback

get_registration_deployment(arg1, arg2, arg3)

Specs

get_registration_deployment(String.t(), String.t(), String.t()) ::
  {%Lti_1p3.Tool.Registration{
     auth_login_url: term(),
     auth_server: term(),
     auth_token_url: term(),
     client_id: term(),
     id: term(),
     issuer: term(),
     key_set_url: term(),
     tool_jwk_id: term()
   },
   %Lti_1p3.Tool.Deployment{
     deployment_id: term(),
     id: term(),
     registration_id: term()
   }}
  | nil

Gets the registration and deployment associated with the given issuer, client_id and deployment_id.

Examples

iex> get_registration_deployment(issuer, client_id, deployment_id)
{%Registration{}, %Deployment{}}
iex> get_rd_by_deployment_id(issuer, client_id, deployment_id)
{nil, nil}