IMS LTI 1.3 based starter (sample) application written using Java and Spring Boot
The goal is to have a Java based web app which can serve as the basis (or starting point) for building a fully compliant LTI 1.3 tool.
This will produce a lti13demo.jar file in the target directory
mvn clean install
note, to avoid some test errors if those happen, try
mvn install -DskipTests=true
You can run the app in place to try it out without having to install and deploy a servlet container.
mvn clean install -DskipTests=true spring-boot:run
NOTE: To run it and connect it to real LMSs it is recommended to run it in an accessible server with a valid certificate.
Connect to your mysql server and use your values on YOURDATABASE, YOURDATABASEUSERNAME, YOURDATABASEUSERPASSWORD Set the right values in the properties file. This code was last tested with MySQL version 8.0.28.
mysql> create database YOURDATABASE DEFAULT CHARACTER SET utf8 ; Query OK, 1 row affected (0.00 sec)
mysql> create user 'YOURDATABASEUSERNAME'@'%' identified by 'YOURDATABASEUSERPASSWORD'; Query OK, 0 rows affected (0.00 sec)
mysql> grant all on YOURDATABASE.* to 'YOURDATABASEUSERNAME'@'%'; Query OK, 0 rows affected (0.00 sec)
Use the application.properties to control various aspects of the Spring Boot application (like setup your own database connection). The example file has some section with a self-explanatory title. Of course it is recommended to use a properties file external to the jar to avoid to store sensitive values in your code:
--spring.config.location=/home/yourhomefolder/application-local.properties
openssl genrsa -out keypair.pem 2048
openssl rsa -in keypair.pem -pubout -out publickey.crt
cat publickey.crt
oidc.publickey
inside the application.properties file. Ensure that each newline is indicated by \n (may need to do a find \n
and replace with \\n
)openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in keypair.pem -out pkcs8.key
cat pkcs8.key
oidc.privatekey
inside the application.properties file. Ensure that each newline is indicated by \n (may need to do a find \n
and replace with \\n
)Note: As of 8/11/2021, for Mac, this works with Firefox but not Chrome.
cd ~/PATH/tool13demo/src/main/resources
keytool -genkeypair -alias keystoreAlias -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore keystore.p12 -validity 3650
application.properties
file, ensure that each of these variables have the correct values filled in:
server.port=443
security.require-ssl=true
server.ssl.key-store=classpath:keystore.p12
server.ssl.key-store-password=<password from step 2>
server.ssl.keyStoreType=PKCS12
server.ssl.keyAlias=keystoreAlias
security.headers.frame=false
application.url=https://localhost:443
./ngrok http 9090
(Note: This port number must match the value of server.port
in the application.properties file.)Note: Each time you restart ngrok, you will need to change the url of your tool in your registration with the LMS. However, you may restart the tool as much as you like while leaving ngrok running without issue.