Skip to content

Latest commit

 

History

History
108 lines (75 loc) · 4.08 KB

File metadata and controls

108 lines (75 loc) · 4.08 KB

NP.Lti13Platform.NameRoleProvisioningServices

The IMS Name and Role Provisioning Services spec defines a way that tools can request the names and roles of members of a context. This project provides an implementation of the spec.

Features

  • Returns the members of a context

Getting Started

  1. Add the nuget package to your project:

  2. Add an implementation of the ILti13NameRoleProvisioningDataService interface:

public class DataService: ILti13NameRoleProvisioningDataService
{
    ...
}
  1. Add the required services.
builder.Services
    .AddLti13PlatformCore()
    .AddLti13PlatformNameRoleProvisioningServices()
    .WithLti13NameRoleProvisioningDataService<DataService>();
  1. Setup the routing for the LTI 1.3 platform endpoints:
app.UseLti13PlatformNameRoleProvisioningServices();

ILti13NameRoleProvisioningDataService

There is no default ILti13NameRoleProvisioningDataService implementation to allow each project to store the data how they see fit.

The ILti13NameRoleProvisioningDataService interface is used to get the persisted members of a context filtered by multiple parameters.

All of the internal services are transient and therefore the data service may be added at any scope (Transient, Scoped, Singleton).

Defaults

Routing

Default routes are provided for all endpoints. Routes can be configured when calling UseLti13PlatformNameRoleProvisioningServices().

app.UseLti13PlatformNameRoleProvisioningServices(config => {
    config.NamesAndRoleProvisioningServicesUrl = "/lti13/{deploymentId}/{contextId}/memberships"; // {deploymentId} and {contextId} are required
    return config;
});

ILti13NameRoleProvisioningConfigService

The ILti13NameRoleProvisioningService interface is used to get the config for the name and role provisioning service. The config is used to tell the tools how to request the members of a context.

There is a default implementation of the ILti13NameRoleProvisioningConfigService interface that uses a configuration set up on app start. It will be configured using the IOptions pattern and configuration. The configuration path for the service is Lti13Platform:NameRoleProvisioningServices.

Examples:

{
    "Lti13Platform": {
        "NameRoleProvisioningServices": {
            "ServiceAddress": "https://<mysite>"
        }
    }
}
builder.Services.Configure<ServicesConfig>(x => { });

The Default implementation can be overridden by adding a new implementation of the ILti13NameRoleProvisioningConfigService interface. This may be useful if the service URL is dynamic or needs to be determined at runtime.

builder.Services
    .AddLti13PlatformCore()
    .AddLti13PlatformNameRoleProvisioningServices()
    .WithLti13NameRoleProvisioningConfigService<ConfigService>();

Configuration

ServiceAddress

The base url used to tell tools where the service is located.

Member Message

The IMS Name and Role Provisioning Services spec defines a way to give tools access to the parts of LTI messages that are specific to members. This project includes the specifics for the core message and known properties defined within the spec. Additional message can be added by calling ExtendNameRoleProvisioningMessage on startup. This follows the same pattern as Populators from the core spec. These messages should only contain the user specific message properties of the given message. Multiple populators may be added for the same interface and multiple interfaces may be added for the same <message_type>. Populators must be thread safe or have a Transient Dependency Injection strategy.

builder.Services
    .AddLti13PlatformCore()
    .AddLti13PlatformNameRoleProvisioningServices()
    .WithDefaultNameRoleProvisioningService()
    .ExtendNameRoleProvisioningMessage<IMessage, MessagePopulator>("<message_type>");