https://github.com/indiana-university/lms-canvas-lti-framework
Shared services for the lms-canvas LTI tools around the LTI tool launch
https://github.com/indiana-university/lms-canvas-lti-framework
canvas lms lti
Last synced: 6 months ago
JSON representation
Shared services for the lms-canvas LTI tools around the LTI tool launch
- Host: GitHub
- URL: https://github.com/indiana-university/lms-canvas-lti-framework
- Owner: indiana-university
- License: bsd-3-clause
- Created: 2021-09-23T12:39:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-13T22:32:51.000Z (over 2 years ago)
- Last Synced: 2023-03-02T03:02:11.830Z (about 2 years ago)
- Topics: canvas, lms, lti
- Language: Java
- Homepage:
- Size: 184 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LMS Canvas LTI Framework Services
When this library is added to a project it allows for LTI framework service details to be setup.
## Installation
### From Maven
Add the following as a dependency in your pom.xml
```xmledu.iu.uits.lms
lms-canvas-lti-framework
```
You can find the latest version in [Maven Central](https://search.maven.org/search?q=g:edu.iu.uits.lms%20AND%20a:lms-canvas-lti-framework).
## Setup Examples
### Include annotation to enable to the configs
Add to any configuration class, or even the main application class `@EnableLtiClient(toolKeys = {"example_tool_id"})`.Replace `example_tool_id` with something that will uniquely identify your tool. Once that has been done, you can autowire in and use any lti service. Generally, you won't use them directly, but they are used in various configurations.
### Override default role mappings
Implement a class, similar to the below
```java
public class CustomRoleMapper extends LmsDefaultGrantedAuthoritiesMapper {
@Override
protected List getDefaultInstructorRoles() {
return Arrays.asList("special", "roles", "here");
}
}
```
Then, just use that when configuring...
```java
Lti13Configurer lti13Configurer = new Lti13Configurer()
.grantedAuthoritiesMapper(new CustomRoleMapper());
```## Setup Database
After compiling, see `target/generated-resources/sql/ddl/auto/postgresql9.sql` for appropriate ddl.
Insert a record into the `LTI_13_AUTHZ` table with your tool's registration_id (`example_tool_id`, from above), along with the client_id and secret from Canvas's Developer Key. An `env` designator is also required here, and allows a database to support multiple environments simultaneously (dev and reg, for example).## Configuration
If choosing to use properties files for the configuration values, the default location is `/usr/src/app/config`, but that can be overridden by setting the `app.fullFilePath` value via system property or environment variable.### Database Configuration
The following properties need to be set to configure the communication with a database.
They can be set in a security.properties file, or overridden as environment variables.| Property | Description |
|----------------------|------------------------------------------------------------------------------------------------------------------------|
| `lms.db.user` | Username used to access the database |
| `lms.db.url` | JDBC URL of the database. Will have the form `jdbc:://:/` |
| `lms.db.password` | Password for the user accessing the database |
| `lms.db.poolType` | Fully qualified name of the connection pool implementation to use. By default, it is auto-detected from the classpath. |### Configure support contact information
The following properties need to be set to configure the contact information on the global error page.
They can be set in a security.properties file, or overridden as environment variables.| Property | Description |
|-------------------------|-----------------------------------------------------------------------------------------------------------|
| `lti.errorcontact.name` | Display name for your support organization |
| `lti.errorcontact.link` | Contact mechanism - URL or mailto:email (e.g. `http://support.school.edu` or `mailto:[email protected]`) |### Exposing the LTI authz REST endpoints
If you would like to expose the LTI authz endpoints in a tool (for CRUD operations on the LTI authorizations), you will
need to enable it by including the value `ltirest` into the `SPRING_PROFILES_ACTIVE` environment variable. Be aware that if the tool requires multiple values, that there could be more than one profile value in there.#### OAuth2 requirements
In order to get access to the endpoints, you'd need to configure an OAuth2 server. Once setup, the user(s) needing access
would have to be granted the `lti:read` and/or the `lti:write` scopes as appropriate. Grant type should be set as `Authorization Code`.#### REST endpoint documentation
See the [wiki](wiki/API-Endpoint-Documentation) for details.#### Dev notes
To generate the REST docs (asciidoc) that live in the github wiki, take the following steps:
1. Enable the rest endpoints and swagger in the tool of choice and start it up
2. Note the api docs url. Should be something like http://localhost:8080/api/lti/v3/api-docs
3. Download the openapi-generator from [here](https://openapi-generator.tech/docs/installation)
4. Run the following (:warning: *Command could be slightly different based on your OS and install method*):
`openapi-generator generate -g asciidoc -i `
5. Take the generated output and update the wiki page (:warning: *Some hand editing may be required*)