Skip to content

A platform for community discussion. Free, open, simple.

DEV: Move discourse-lti to core (#33570)

Jarek Radosz4fa3a172119c
diff --git a/.github/labeler.yml b/.github/labeler.yml
index 9393833f1b6..3f4afbda6d1 100644
--- a/.github/labeler.yml
+++ b/.github/labeler.yml
@@ -38,6 +38,10 @@ discourse-login-with-amazon:
- changed-files:
- any-glob-to-any-file: plugins/discourse-login-with-amazon/**/*
+discourse-lti:
+ - changed-files:
+ - any-glob-to-any-file: plugins/discourse-lti/**/*
+
discourse-microsoft-auth:
- changed-files:
- any-glob-to-any-file: plugins/discourse-microsoft-auth/**/*
diff --git a/.gitignore b/.gitignore
index 72b6f940617..fe3af50f6be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -52,6 +52,7 @@
!/plugins/discourse-reactions
!/plugins/discourse-apple-auth
!/plugins/discourse-login-with-amazon
+!/plugins/discourse-lti
!/plugins/discourse-microsoft-auth
/plugins/*/auto_generated
diff --git a/plugins/discourse-lti/README.md b/plugins/discourse-lti/README.md
new file mode 100644
index 00000000000..c3d62b5ab42
--- /dev/null
+++ b/plugins/discourse-lti/README.md
@@ -0,0 +1,5 @@
+# Learning Management System Integration Plugin
+
+A plugin which allows Discourse to act as an [Learning Tools Interoperability (1.3)](https://www.imsglobal.org/activity/learning-tools-interoperability) Tool
+
+For more information, please see: https://meta.discourse.org/t/learning-management-system-integration-lti-1-3-authentication/196174
diff --git a/plugins/discourse-lti/assets/javascripts/discourse-lti/api-initializers/hide-lti-login-button.js b/plugins/discourse-lti/assets/javascripts/discourse-lti/api-initializers/hide-lti-login-button.js
new file mode 100644
index 00000000000..458f74729f6
--- /dev/null
+++ b/plugins/discourse-lti/assets/javascripts/discourse-lti/api-initializers/hide-lti-login-button.js
@@ -0,0 +1,26 @@
+import { apiInitializer } from "discourse/lib/api";
+import discourseComputed from "discourse/lib/decorators";
+import { findAll } from "discourse/models/login-method";
+
+export default apiInitializer("0.8", (api) => {
+ // LTI login must be initiated by the IdP
+ // Hide the LTI login button on the client side:
+ api.modifyClass(
+ "component:login-buttons",
+ (Superclass) =>
+ class extends Superclass {
+ @discourseComputed
+ buttons() {
+ return super.buttons.filter((m) => m.name !== "lti");
+ }
+ }
+ );
+
+ // Connection is possible, but cannot be initiated
+ // by Discourse. It must be initiated by the IdP.
+ // Hide the button to avoid confusion:
+ const lti = findAll().find((p) => p.name === "lti");
+ if (lti) {
+ lti.can_connect = false;
+ }
+});
diff --git a/plugins/discourse-lti/config/locales/client.ar.yml b/plugins/discourse-lti/config/locales/client.ar.yml
new file mode 100644
index 00000000000..8629576ec0c
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.ar.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ar:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "باستخدام LTI"
diff --git a/plugins/discourse-lti/config/locales/client.be.yml b/plugins/discourse-lti/config/locales/client.be.yml
new file mode 100644
index 00000000000..2ea77a0d350
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.be.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+be:
diff --git a/plugins/discourse-lti/config/locales/client.bg.yml b/plugins/discourse-lti/config/locales/client.bg.yml
new file mode 100644
index 00000000000..52333529d3c
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.bg.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+bg:
diff --git a/plugins/discourse-lti/config/locales/client.bs_BA.yml b/plugins/discourse-lti/config/locales/client.bs_BA.yml
new file mode 100644
index 00000000000..828a7e65af8
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.bs_BA.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+bs_BA:
diff --git a/plugins/discourse-lti/config/locales/client.ca.yml b/plugins/discourse-lti/config/locales/client.ca.yml
new file mode 100644
index 00000000000..ec737bc1a5b
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.ca.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ca:
diff --git a/plugins/discourse-lti/config/locales/client.cs.yml b/plugins/discourse-lti/config/locales/client.cs.yml
new file mode 100644
index 00000000000..041b2f0bd05
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.cs.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+cs:
diff --git a/plugins/discourse-lti/config/locales/client.da.yml b/plugins/discourse-lti/config/locales/client.da.yml
new file mode 100644
index 00000000000..f39c727c594
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.da.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+da:
diff --git a/plugins/discourse-lti/config/locales/client.de.yml b/plugins/discourse-lti/config/locales/client.de.yml
new file mode 100644
index 00000000000..3cb505da7fe
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.de.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+de:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "mit LTI"
diff --git a/plugins/discourse-lti/config/locales/client.el.yml b/plugins/discourse-lti/config/locales/client.el.yml
new file mode 100644
index 00000000000..d872d0ecc40
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.el.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+el:
diff --git a/plugins/discourse-lti/config/locales/client.en.yml b/plugins/discourse-lti/config/locales/client.en.yml
new file mode 100644
index 00000000000..c6facd47e8d
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.en.yml
@@ -0,0 +1,6 @@
+en:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "with LTI"
diff --git a/plugins/discourse-lti/config/locales/client.en_GB.yml b/plugins/discourse-lti/config/locales/client.en_GB.yml
new file mode 100644
index 00000000000..2d4fa180ec7
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.en_GB.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+en_GB:
diff --git a/plugins/discourse-lti/config/locales/client.es.yml b/plugins/discourse-lti/config/locales/client.es.yml
new file mode 100644
index 00000000000..bfe02f7e6e9
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.es.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+es:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "con LTI"
diff --git a/plugins/discourse-lti/config/locales/client.et.yml b/plugins/discourse-lti/config/locales/client.et.yml
new file mode 100644
index 00000000000..0ea0b6d554b
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.et.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+et:
diff --git a/plugins/discourse-lti/config/locales/client.fa_IR.yml b/plugins/discourse-lti/config/locales/client.fa_IR.yml
new file mode 100644
index 00000000000..56512089fb5
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.fa_IR.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fa_IR:
diff --git a/plugins/discourse-lti/config/locales/client.fi.yml b/plugins/discourse-lti/config/locales/client.fi.yml
new file mode 100644
index 00000000000..01ec6b82a91
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.fi.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fi:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "LTI:llä"
diff --git a/plugins/discourse-lti/config/locales/client.fr.yml b/plugins/discourse-lti/config/locales/client.fr.yml
new file mode 100644
index 00000000000..05ca8d5544c
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.fr.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fr:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "avec LTI"
diff --git a/plugins/discourse-lti/config/locales/client.gl.yml b/plugins/discourse-lti/config/locales/client.gl.yml
new file mode 100644
index 00000000000..fb911ce1635
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.gl.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+gl:
diff --git a/plugins/discourse-lti/config/locales/client.he.yml b/plugins/discourse-lti/config/locales/client.he.yml
new file mode 100644
index 00000000000..72ffb52ba0b
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.he.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+he:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "עם LTI"
diff --git a/plugins/discourse-lti/config/locales/client.hr.yml b/plugins/discourse-lti/config/locales/client.hr.yml
new file mode 100644
index 00000000000..93343ce6e19
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.hr.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hr:
diff --git a/plugins/discourse-lti/config/locales/client.hu.yml b/plugins/discourse-lti/config/locales/client.hu.yml
new file mode 100644
index 00000000000..76b6e9d8bcb
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.hu.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hu:
diff --git a/plugins/discourse-lti/config/locales/client.hy.yml b/plugins/discourse-lti/config/locales/client.hy.yml
new file mode 100644
index 00000000000..cb18f64d356
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.hy.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hy:
diff --git a/plugins/discourse-lti/config/locales/client.id.yml b/plugins/discourse-lti/config/locales/client.id.yml
new file mode 100644
index 00000000000..596e36b2e13
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.id.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+id:
diff --git a/plugins/discourse-lti/config/locales/client.it.yml b/plugins/discourse-lti/config/locales/client.it.yml
new file mode 100644
index 00000000000..9be89b52161
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.it.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+it:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "con LTI"
diff --git a/plugins/discourse-lti/config/locales/client.ja.yml b/plugins/discourse-lti/config/locales/client.ja.yml
new file mode 100644
index 00000000000..de1360b8579
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.ja.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ja:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "LTI"
diff --git a/plugins/discourse-lti/config/locales/client.ko.yml b/plugins/discourse-lti/config/locales/client.ko.yml
new file mode 100644
index 00000000000..18dd77fd3ec
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.ko.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ko:
diff --git a/plugins/discourse-lti/config/locales/client.lt.yml b/plugins/discourse-lti/config/locales/client.lt.yml
new file mode 100644
index 00000000000..16bb19758dc
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.lt.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+lt:
diff --git a/plugins/discourse-lti/config/locales/client.lv.yml b/plugins/discourse-lti/config/locales/client.lv.yml
new file mode 100644
index 00000000000..59e0ef6f4ed
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.lv.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+lv:
diff --git a/plugins/discourse-lti/config/locales/client.nb_NO.yml b/plugins/discourse-lti/config/locales/client.nb_NO.yml
new file mode 100644
index 00000000000..2e2224d1472
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.nb_NO.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+nb_NO:
diff --git a/plugins/discourse-lti/config/locales/client.nl.yml b/plugins/discourse-lti/config/locales/client.nl.yml
new file mode 100644
index 00000000000..bbf29e164b4
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.nl.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+nl:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "met LTI"
diff --git a/plugins/discourse-lti/config/locales/client.pl_PL.yml b/plugins/discourse-lti/config/locales/client.pl_PL.yml
new file mode 100644
index 00000000000..a1fbeb9167f
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.pl_PL.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pl_PL:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "z LTI"
diff --git a/plugins/discourse-lti/config/locales/client.pt.yml b/plugins/discourse-lti/config/locales/client.pt.yml
new file mode 100644
index 00000000000..298ba523c1d
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.pt.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pt:
diff --git a/plugins/discourse-lti/config/locales/client.pt_BR.yml b/plugins/discourse-lti/config/locales/client.pt_BR.yml
new file mode 100644
index 00000000000..e709b6682e7
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.pt_BR.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pt_BR:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "com LTI"
diff --git a/plugins/discourse-lti/config/locales/client.ro.yml b/plugins/discourse-lti/config/locales/client.ro.yml
new file mode 100644
index 00000000000..08a77f812ee
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.ro.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ro:
diff --git a/plugins/discourse-lti/config/locales/client.ru.yml b/plugins/discourse-lti/config/locales/client.ru.yml
new file mode 100644
index 00000000000..3b61712652d
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.ru.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ru:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "с помощью LTI"
diff --git a/plugins/discourse-lti/config/locales/client.sk.yml b/plugins/discourse-lti/config/locales/client.sk.yml
new file mode 100644
index 00000000000..6f815624081
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.sk.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sk:
diff --git a/plugins/discourse-lti/config/locales/client.sl.yml b/plugins/discourse-lti/config/locales/client.sl.yml
new file mode 100644
index 00000000000..23489a48b1f
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.sl.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sl:
diff --git a/plugins/discourse-lti/config/locales/client.sq.yml b/plugins/discourse-lti/config/locales/client.sq.yml
new file mode 100644
index 00000000000..7f051b7a7cf
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.sq.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sq:
diff --git a/plugins/discourse-lti/config/locales/client.sr.yml b/plugins/discourse-lti/config/locales/client.sr.yml
new file mode 100644
index 00000000000..88d63d6ae1a
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.sr.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sr:
diff --git a/plugins/discourse-lti/config/locales/client.sv.yml b/plugins/discourse-lti/config/locales/client.sv.yml
new file mode 100644
index 00000000000..cccce768184
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.sv.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sv:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "med LTI"
diff --git a/plugins/discourse-lti/config/locales/client.sw.yml b/plugins/discourse-lti/config/locales/client.sw.yml
new file mode 100644
index 00000000000..0d7cdd075bf
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.sw.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sw:
diff --git a/plugins/discourse-lti/config/locales/client.te.yml b/plugins/discourse-lti/config/locales/client.te.yml
new file mode 100644
index 00000000000..03967bdbb07
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.te.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+te:
diff --git a/plugins/discourse-lti/config/locales/client.th.yml b/plugins/discourse-lti/config/locales/client.th.yml
new file mode 100644
index 00000000000..7de85ff91c4
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.th.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+th:
diff --git a/plugins/discourse-lti/config/locales/client.tr_TR.yml b/plugins/discourse-lti/config/locales/client.tr_TR.yml
new file mode 100644
index 00000000000..0850b3edb81
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.tr_TR.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+tr_TR:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "LTI ile"
diff --git a/plugins/discourse-lti/config/locales/client.ug.yml b/plugins/discourse-lti/config/locales/client.ug.yml
new file mode 100644
index 00000000000..a6bf0185ae2
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.ug.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ug:
diff --git a/plugins/discourse-lti/config/locales/client.uk.yml b/plugins/discourse-lti/config/locales/client.uk.yml
new file mode 100644
index 00000000000..f1390545d1d
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.uk.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+uk:
diff --git a/plugins/discourse-lti/config/locales/client.ur.yml b/plugins/discourse-lti/config/locales/client.ur.yml
new file mode 100644
index 00000000000..b4a9c21ee2f
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.ur.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ur:
diff --git a/plugins/discourse-lti/config/locales/client.vi.yml b/plugins/discourse-lti/config/locales/client.vi.yml
new file mode 100644
index 00000000000..f629dcf5329
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.vi.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+vi:
diff --git a/plugins/discourse-lti/config/locales/client.zh_CN.yml b/plugins/discourse-lti/config/locales/client.zh_CN.yml
new file mode 100644
index 00000000000..197c0d023af
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.zh_CN.yml
@@ -0,0 +1,12 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+zh_CN:
+ js:
+ login:
+ lti:
+ name: "LTI"
+ title: "使用 LTI"
diff --git a/plugins/discourse-lti/config/locales/client.zh_TW.yml b/plugins/discourse-lti/config/locales/client.zh_TW.yml
new file mode 100644
index 00000000000..7e15fab0018
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/client.zh_TW.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+zh_TW:
diff --git a/plugins/discourse-lti/config/locales/server.ar.yml b/plugins/discourse-lti/config/locales/server.ar.yml
new file mode 100644
index 00000000000..f2114e02e66
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.ar.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ar:
+ site_settings:
+ lti_enabled: تفعيل مصادقة LTI 1.3
+ lti_authorization_endpoint: نقطة نهاية مصادقة منصة LTI
+ lti_client_ids: معرِّفات العميل لهذه الأداة
+ lti_platform_issuer_id: معرِّف المُصدر لمنصة LTI. عادةً ما يكون عنوان URL، بما في ذلك https://
+ lti_platform_public_key: المفتاح العام لمنصة LTI
+ lti_email_verified: التفعيل إذا تم التحقُّق من عناوين البريد الإلكتروني من المنصة.
diff --git a/plugins/discourse-lti/config/locales/server.be.yml b/plugins/discourse-lti/config/locales/server.be.yml
new file mode 100644
index 00000000000..2ea77a0d350
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.be.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+be:
diff --git a/plugins/discourse-lti/config/locales/server.bg.yml b/plugins/discourse-lti/config/locales/server.bg.yml
new file mode 100644
index 00000000000..52333529d3c
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.bg.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+bg:
diff --git a/plugins/discourse-lti/config/locales/server.bs_BA.yml b/plugins/discourse-lti/config/locales/server.bs_BA.yml
new file mode 100644
index 00000000000..828a7e65af8
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.bs_BA.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+bs_BA:
diff --git a/plugins/discourse-lti/config/locales/server.ca.yml b/plugins/discourse-lti/config/locales/server.ca.yml
new file mode 100644
index 00000000000..ec737bc1a5b
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.ca.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ca:
diff --git a/plugins/discourse-lti/config/locales/server.cs.yml b/plugins/discourse-lti/config/locales/server.cs.yml
new file mode 100644
index 00000000000..041b2f0bd05
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.cs.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+cs:
diff --git a/plugins/discourse-lti/config/locales/server.da.yml b/plugins/discourse-lti/config/locales/server.da.yml
new file mode 100644
index 00000000000..f39c727c594
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.da.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+da:
diff --git a/plugins/discourse-lti/config/locales/server.de.yml b/plugins/discourse-lti/config/locales/server.de.yml
new file mode 100644
index 00000000000..e8df52ce9c4
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.de.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+de:
+ site_settings:
+ lti_enabled: LTI-1.3-Authentifizierung aktivieren
+ lti_authorization_endpoint: Der Autorisierungsendpunkt der LTI-Plattform
+ lti_client_ids: Die Client-IDs für dieses Tool
+ lti_platform_issuer_id: Die Aussteller-ID für die LTI-Plattform. Normalerweise eine URL, einschließlich https://
+ lti_platform_public_key: Der öffentliche Schlüssel der LTI-Plattform
+ lti_email_verified: Aktiviere diese Option, wenn die E-Mail-Adressen von der Plattform verifiziert wurden.
diff --git a/plugins/discourse-lti/config/locales/server.el.yml b/plugins/discourse-lti/config/locales/server.el.yml
new file mode 100644
index 00000000000..d872d0ecc40
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.el.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+el:
diff --git a/plugins/discourse-lti/config/locales/server.en.yml b/plugins/discourse-lti/config/locales/server.en.yml
new file mode 100644
index 00000000000..df7ee1192a9
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.en.yml
@@ -0,0 +1,8 @@
+en:
+ site_settings:
+ lti_enabled: Enable LTI 1.3 authentication
+ lti_authorization_endpoint: The LTI platform's Authorization Endpoint
+ lti_client_ids: The client ids for this tool
+ lti_platform_issuer_id: The issuer ID for the LTI Platform. Normally a URL, including https://
+ lti_platform_public_key: The LTI Platform's public key
+ lti_email_verified: Enable if email addresses from the Platform have been verified.
diff --git a/plugins/discourse-lti/config/locales/server.en_GB.yml b/plugins/discourse-lti/config/locales/server.en_GB.yml
new file mode 100644
index 00000000000..2d4fa180ec7
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.en_GB.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+en_GB:
diff --git a/plugins/discourse-lti/config/locales/server.es.yml b/plugins/discourse-lti/config/locales/server.es.yml
new file mode 100644
index 00000000000..5d3ab49bc54
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.es.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+es:
+ site_settings:
+ lti_enabled: Habilitar la autenticación LTI 1.3
+ lti_authorization_endpoint: El terminal de autorización de la plataforma LTI
+ lti_client_ids: Los ID de cliente para esta herramienta
+ lti_platform_issuer_id: El ID del emisor de la plataforma LTI. Normalmente es una URL, que incluye https://
+ lti_platform_public_key: La clave pública de la plataforma LTI
+ lti_email_verified: Actívala si se han verificado las direcciones de correo electrónico de la Plataforma.
diff --git a/plugins/discourse-lti/config/locales/server.et.yml b/plugins/discourse-lti/config/locales/server.et.yml
new file mode 100644
index 00000000000..0ea0b6d554b
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.et.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+et:
diff --git a/plugins/discourse-lti/config/locales/server.fa_IR.yml b/plugins/discourse-lti/config/locales/server.fa_IR.yml
new file mode 100644
index 00000000000..56512089fb5
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.fa_IR.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fa_IR:
diff --git a/plugins/discourse-lti/config/locales/server.fi.yml b/plugins/discourse-lti/config/locales/server.fi.yml
new file mode 100644
index 00000000000..44819a78a0b
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.fi.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fi:
+ site_settings:
+ lti_enabled: Ota LTI 1.3 -todennus käyttöön
+ lti_authorization_endpoint: LTI-alustan valtuutuspäätepiste
+ lti_client_ids: Tämän työkalun asiakastunnukset
+ lti_platform_issuer_id: LTI-alustan myöntäjän tunnus. Yleensä URL-osoite, mukaan lukien https://.
+ lti_platform_public_key: LTI-alustan julkinen avain
+ lti_email_verified: Ota käyttöön, jos alustan sähköpostiosoitteet on vahvistettu.
diff --git a/plugins/discourse-lti/config/locales/server.fr.yml b/plugins/discourse-lti/config/locales/server.fr.yml
new file mode 100644
index 00000000000..8455b23b191
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.fr.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+fr:
+ site_settings:
+ lti_enabled: Activer l'authentification LTI 1.3
+ lti_authorization_endpoint: Le point de terminaison d'autorisation de la plateforme LTI
+ lti_client_ids: Les identifiants client pour cet outil
+ lti_platform_issuer_id: L'identifiant de l'émetteur pour la plateforme LTI. Normalement une URL comprenant https://
+ lti_platform_public_key: La clé publique de la plateforme LTI
+ lti_email_verified: Activer si les adresses e-mail de la plateforme ont été vérifiées.
diff --git a/plugins/discourse-lti/config/locales/server.gl.yml b/plugins/discourse-lti/config/locales/server.gl.yml
new file mode 100644
index 00000000000..fb911ce1635
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.gl.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+gl:
diff --git a/plugins/discourse-lti/config/locales/server.he.yml b/plugins/discourse-lti/config/locales/server.he.yml
new file mode 100644
index 00000000000..8bba94560a3
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.he.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+he:
+ site_settings:
+ lti_enabled: הפעלת אימות LTI 1.3
+ lti_authorization_endpoint: נקודת גישה לאימות מול הפלטפורמה של LTI
+ lti_client_ids: מזהי הלקוח עבור הכלי הזה
+ lti_platform_issuer_id: מזהה המנפיק לפלטפורמת LTI. בדרך כלל כתובת, כולל https://‎
+ lti_platform_public_key: המפתח הציבורי של פלטפורמת LTI
+ lti_email_verified: יש להפעיל אם כתובת הדוא״ל מהפלטפורמה אומתה.
diff --git a/plugins/discourse-lti/config/locales/server.hr.yml b/plugins/discourse-lti/config/locales/server.hr.yml
new file mode 100644
index 00000000000..93343ce6e19
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.hr.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hr:
diff --git a/plugins/discourse-lti/config/locales/server.hu.yml b/plugins/discourse-lti/config/locales/server.hu.yml
new file mode 100644
index 00000000000..76b6e9d8bcb
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.hu.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hu:
diff --git a/plugins/discourse-lti/config/locales/server.hy.yml b/plugins/discourse-lti/config/locales/server.hy.yml
new file mode 100644
index 00000000000..cb18f64d356
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.hy.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+hy:
diff --git a/plugins/discourse-lti/config/locales/server.id.yml b/plugins/discourse-lti/config/locales/server.id.yml
new file mode 100644
index 00000000000..596e36b2e13
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.id.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+id:
diff --git a/plugins/discourse-lti/config/locales/server.it.yml b/plugins/discourse-lti/config/locales/server.it.yml
new file mode 100644
index 00000000000..8ea03d12b55
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.it.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+it:
+ site_settings:
+ lti_enabled: Abilita l'autenticazione LTI 1.3
+ lti_authorization_endpoint: Endpoint di autorizzazione della piattaforma LTI
+ lti_client_ids: Gli ID client per questo strumento
+ lti_platform_issuer_id: L'ID dell'emittente per la piattaforma LTI. Normalmente un URL, comprendente https://
+ lti_platform_public_key: Chiave pubblica della piattaforma LTI
+ lti_email_verified: Controlla se gli indirizzi email della piattaforma sono stati verificati.
diff --git a/plugins/discourse-lti/config/locales/server.ja.yml b/plugins/discourse-lti/config/locales/server.ja.yml
new file mode 100644
index 00000000000..3eddee4e685
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.ja.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ja:
+ site_settings:
+ lti_enabled: LTI 1.3 認証を有効にする
+ lti_authorization_endpoint: LTI プラットフォームの承認エンドポイント
+ lti_client_ids: このツールのクライアント ID
+ lti_platform_issuer_id: LTI プラットフォームの発行者 ID。通常、https:// を含む URL
+ lti_platform_public_key: LTI プラットフォームの公開鍵
+ lti_email_verified: プラットフォームのメールアドレスが確認されている場合に有効にします。
diff --git a/plugins/discourse-lti/config/locales/server.ko.yml b/plugins/discourse-lti/config/locales/server.ko.yml
new file mode 100644
index 00000000000..18dd77fd3ec
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.ko.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ko:
diff --git a/plugins/discourse-lti/config/locales/server.lt.yml b/plugins/discourse-lti/config/locales/server.lt.yml
new file mode 100644
index 00000000000..16bb19758dc
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.lt.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+lt:
diff --git a/plugins/discourse-lti/config/locales/server.lv.yml b/plugins/discourse-lti/config/locales/server.lv.yml
new file mode 100644
index 00000000000..59e0ef6f4ed
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.lv.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+lv:
diff --git a/plugins/discourse-lti/config/locales/server.nb_NO.yml b/plugins/discourse-lti/config/locales/server.nb_NO.yml
new file mode 100644
index 00000000000..2e2224d1472
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.nb_NO.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+nb_NO:
diff --git a/plugins/discourse-lti/config/locales/server.nl.yml b/plugins/discourse-lti/config/locales/server.nl.yml
new file mode 100644
index 00000000000..38f12577590
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.nl.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+nl:
+ site_settings:
+ lti_enabled: LTI 1.3-verificatie inschakelen
+ lti_authorization_endpoint: Het autorisatie-eindpunt van het LTI-platform
+ lti_client_ids: De client-ID's voor deze tool
+ lti_platform_issuer_id: De uitgever-ID voor het LTI-platform. Normaal gesproken een URL, inclusief https://
+ lti_platform_public_key: De openbare sleutel van het LTI-platform
+ lti_email_verified: Schakel dit in als e-mailadressen van het platform zijn geverifieerd.
diff --git a/plugins/discourse-lti/config/locales/server.pl_PL.yml b/plugins/discourse-lti/config/locales/server.pl_PL.yml
new file mode 100644
index 00000000000..cc20d64a83f
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.pl_PL.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pl_PL:
+ site_settings:
+ lti_enabled: Włącz uwierzytelnianie LTI 1.3
+ lti_authorization_endpoint: Punkt końcowy autoryzacji platformy LTI
+ lti_client_ids: Identyfikatory klienta dla tego narzędzia
+ lti_platform_issuer_id: Identyfikator wydawcy dla platformy LTI. Zwykle adres URL, w tym https://
+ lti_platform_public_key: Klucz publiczny platformy LTI
+ lti_email_verified: Włącz, jeśli adresy e-mail z platformy zostały zweryfikowane.
diff --git a/plugins/discourse-lti/config/locales/server.pt.yml b/plugins/discourse-lti/config/locales/server.pt.yml
new file mode 100644
index 00000000000..298ba523c1d
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.pt.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pt:
diff --git a/plugins/discourse-lti/config/locales/server.pt_BR.yml b/plugins/discourse-lti/config/locales/server.pt_BR.yml
new file mode 100644
index 00000000000..c6342ad2437
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.pt_BR.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+pt_BR:
+ site_settings:
+ lti_enabled: Ativar autenticação LTI 1.3
+ lti_authorization_endpoint: O ponto de extremidade de autorização da plataforma LTI
+ lti_client_ids: As ids de cliente para esta ferramenta
+ lti_platform_issuer_id: O ID de emissor(a) para a Plataforma LTI. Geralmente é uma URL, incluindo https://
+ lti_platform_public_key: A chave pública da Plataforma LTI
+ lti_email_verified: Ative se os endereços de e-mail da plataforma tiverem sido verificados.
diff --git a/plugins/discourse-lti/config/locales/server.ro.yml b/plugins/discourse-lti/config/locales/server.ro.yml
new file mode 100644
index 00000000000..08a77f812ee
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.ro.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ro:
diff --git a/plugins/discourse-lti/config/locales/server.ru.yml b/plugins/discourse-lti/config/locales/server.ru.yml
new file mode 100644
index 00000000000..82f845e601e
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.ru.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ru:
+ site_settings:
+ lti_enabled: Включить аутентификацию LTI 1.3
+ lti_authorization_endpoint: Конечная точка авторизации платформы LTI
+ lti_client_ids: Идентификаторы клиента для этого инструмента
+ lti_platform_issuer_id: Идентификатор эмитента для платформы LTI. Обычно URL-адрес, включая https://
+ lti_platform_public_key: Открытый ключ платформы LTI
+ lti_email_verified: Включить, если адреса электронной почты платформы были проверены.
diff --git a/plugins/discourse-lti/config/locales/server.sk.yml b/plugins/discourse-lti/config/locales/server.sk.yml
new file mode 100644
index 00000000000..6f815624081
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.sk.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sk:
diff --git a/plugins/discourse-lti/config/locales/server.sl.yml b/plugins/discourse-lti/config/locales/server.sl.yml
new file mode 100644
index 00000000000..23489a48b1f
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.sl.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sl:
diff --git a/plugins/discourse-lti/config/locales/server.sq.yml b/plugins/discourse-lti/config/locales/server.sq.yml
new file mode 100644
index 00000000000..7f051b7a7cf
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.sq.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sq:
diff --git a/plugins/discourse-lti/config/locales/server.sr.yml b/plugins/discourse-lti/config/locales/server.sr.yml
new file mode 100644
index 00000000000..88d63d6ae1a
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.sr.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sr:
diff --git a/plugins/discourse-lti/config/locales/server.sv.yml b/plugins/discourse-lti/config/locales/server.sv.yml
new file mode 100644
index 00000000000..e4490ca01dc
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.sv.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sv:
+ site_settings:
+ lti_enabled: Aktivera LTI 1.3-autentisering
+ lti_authorization_endpoint: LTI-plattformens auktoriseringsslutpunkt
+ lti_client_ids: Klient-ID:er för detta verktyg
+ lti_platform_issuer_id: Utgivarens ID för LTI-plattformen. Normalt en URL, med https://
+ lti_platform_public_key: LTI -plattformens offentliga nyckel
+ lti_email_verified: Aktivera om e-postadresser från plattformen har verifierats.
diff --git a/plugins/discourse-lti/config/locales/server.sw.yml b/plugins/discourse-lti/config/locales/server.sw.yml
new file mode 100644
index 00000000000..0d7cdd075bf
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.sw.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+sw:
diff --git a/plugins/discourse-lti/config/locales/server.te.yml b/plugins/discourse-lti/config/locales/server.te.yml
new file mode 100644
index 00000000000..03967bdbb07
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.te.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+te:
diff --git a/plugins/discourse-lti/config/locales/server.th.yml b/plugins/discourse-lti/config/locales/server.th.yml
new file mode 100644
index 00000000000..7de85ff91c4
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.th.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+th:
diff --git a/plugins/discourse-lti/config/locales/server.tr_TR.yml b/plugins/discourse-lti/config/locales/server.tr_TR.yml
new file mode 100644
index 00000000000..433743ee15e
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.tr_TR.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+tr_TR:
+ site_settings:
+ lti_enabled: LTI 1.3 kimlik doğrulamasını etkinleştirin
+ lti_authorization_endpoint: LTI platformunun Yetkilendirme Uç Noktası
+ lti_client_ids: Bu araç için istemci kimlikleri
+ lti_platform_issuer_id: LTI Platformu için düzenleyici kimliği. Normalde https:// dahil olacak şekilde bir URL
+ lti_platform_public_key: LTI Platformunun herkese açık anahtarı
+ lti_email_verified: Platformdaki e-posta adresleri doğrulandıysa etkinleştirin.
diff --git a/plugins/discourse-lti/config/locales/server.ug.yml b/plugins/discourse-lti/config/locales/server.ug.yml
new file mode 100644
index 00000000000..a6bf0185ae2
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.ug.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ug:
diff --git a/plugins/discourse-lti/config/locales/server.uk.yml b/plugins/discourse-lti/config/locales/server.uk.yml
new file mode 100644
index 00000000000..f1390545d1d
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.uk.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+uk:
diff --git a/plugins/discourse-lti/config/locales/server.ur.yml b/plugins/discourse-lti/config/locales/server.ur.yml
new file mode 100644
index 00000000000..b4a9c21ee2f
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.ur.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+ur:
diff --git a/plugins/discourse-lti/config/locales/server.vi.yml b/plugins/discourse-lti/config/locales/server.vi.yml
new file mode 100644
index 00000000000..f629dcf5329
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.vi.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+vi:
diff --git a/plugins/discourse-lti/config/locales/server.zh_CN.yml b/plugins/discourse-lti/config/locales/server.zh_CN.yml
new file mode 100644
index 00000000000..264e7e05460
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.zh_CN.yml
@@ -0,0 +1,14 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+zh_CN:
+ site_settings:
+ lti_enabled: 启用 LTI 1.3 身份验证
+ lti_authorization_endpoint: LTI 平台的授权端点
+ lti_client_ids: 此工具的客户端 ID
+ lti_platform_issuer_id: LTI 平台的颁发者 ID。通常是一个 URL,包括 https://
+ lti_platform_public_key: LTI 平台的公钥
+ lti_email_verified: 如果来自平台的电子邮件地址已经过验证,则启用。
diff --git a/plugins/discourse-lti/config/locales/server.zh_TW.yml b/plugins/discourse-lti/config/locales/server.zh_TW.yml
new file mode 100644
index 00000000000..7e15fab0018
--- /dev/null
+++ b/plugins/discourse-lti/config/locales/server.zh_TW.yml
@@ -0,0 +1,7 @@
+# WARNING: Never edit this file.
+# It will be overwritten when translations are pulled from Crowdin.
+#
+# To work with us on translations, join this project:
+# https://translate.discourse.org/
+
+zh_TW:
diff --git a/plugins/discourse-lti/config/settings.yml b/plugins/discourse-lti/config/settings.yml
new file mode 100644
index 00000000000..addc248428c
--- /dev/null
+++ b/plugins/discourse-lti/config/settings.yml
@@ -0,0 +1,15 @@
+plugins:
+ lti_enabled:
+ default: false
+ lti_authorization_endpoint:
+ default: ""
+ lti_client_ids:
+ type: list
+ default: ""
+ lti_platform_issuer_id:
+ default: ""
+ lti_platform_public_key:
+ default: ""
+ textarea: true
+ lti_email_verified:
+ default: false
diff --git a/plugins/discourse-lti/lib/discourse_lti/lti_authenticator.rb b/plugins/discourse-lti/lib/discourse_lti/lti_authenticator.rb
new file mode 100644
index 00000000000..6a458e07c05
--- /dev/null
+++ b/plugins/discourse-lti/lib/discourse_lti/lti_authenticator.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+class ::DiscourseLti::LtiAuthenticator < Auth::ManagedAuthenticator
+ def name
+ "lti"
+ end
+
+ def can_revoke?
+ true
+ end
+
+ def can_connect_existing_user?
+ # Connection is possible, but must be initiated by the IdP.
+ # Discourse's "connect" button is hidden using javascript.
+ true
+ end
+
+ def enabled?
+ SiteSetting.lti_enabled
+ end
+
+ def primary_email_verified?(auth)
+ SiteSetting.lti_email_verified?
+ end
+
+ def register_middleware(omniauth)
+ omniauth.provider ::DiscourseLti::LtiOmniauthStrategy,
+ name: :lti,
+ setup:
+ lambda { |env|
+ opts = env["omniauth.strategy"].options
+ opts.deep_merge!(
+ client_ids: SiteSetting.lti_client_ids.split("|"),
+ authorize_url: SiteSetting.lti_authorization_endpoint,
+ platform_issuer_id: SiteSetting.lti_platform_issuer_id,
+ platform_public_key: SiteSetting.lti_platform_public_key,
+ )
+ }
+ end
+end
diff --git a/plugins/discourse-lti/lib/discourse_lti/lti_omniauth_strategy.rb b/plugins/discourse-lti/lib/discourse_lti/lti_omniauth_strategy.rb
new file mode 100644
index 00000000000..2298161e783
--- /dev/null
+++ b/plugins/discourse-lti/lib/discourse_lti/lti_omniauth_strategy.rb
@@ -0,0 +1,273 @@
+# frozen_string_literal: true
+
+class DiscourseLti::LtiOmniauthStrategy
+ include OmniAuth::Strategy
+
+ # https://www.imsglobal.org/spec/security/v1p0/#openid_connect_launch_flow
+
+ class CallbackError < StandardError
+ attr_accessor :error, :error_reason, :error_uri
+
+ def initialize(error, error_reason = nil, error_uri = nil)
+ self.error = error
+ self.error_reason = error_reason
+ self.error_uri = error_uri
+ end
+
+ def message
+ [error, error_reason, error_uri].compact.join(" | ")
+ end
+ end
+
+ option :client_ids
+ option :authorize_url
+ option :platform_issuer_id
+ option :platform_public_key
+
+ # LTI authentication is only supported as a "third party initiated login"
+ # i.e. all authentication must be started by the 'platform'
+ def request_phase
+ fail!(
+ :third_party_only,
+ StandardError.new("LTI authentication can only be initiated by the identity provider"),
+ )
+ end
+
+ def other_phase
+ methods = %i[get post]
+ if on_initiate_path? && %i[get post].include?(request.request_method.downcase.to_sym)
+ return initiate_phase
+ end
+
+ @app.call(env)
+ end
+
+ def initiate_phase
+ setup_phase
+
+ if cross_site_post?
+ return(
+ resubmit_as_samesite(:iss, :login_hint, :target_link_uri, :lti_message_hint, :client_id)
+ )
+ end
+
+ iss = request.params["iss"]
+ login_hint = request.params["login_hint"]
+ target_link_uri = request.params["target_link_uri"]
+ lti_message_hint = request.params["lti_message_hint"]
+ client_id = request.params["client_id"]
+
+ if !(iss.present? && login_hint.present? && target_link_uri.present?)
+ return(
+ fail! :missing_parameters,
+ RuntimeError.new(
+ "Missing parameters. Requires `iss`, `login_hint` and `target_link_uri`",
+ )
+ )
+ end
+
+ if iss != options.platform_issuer_id
+ return(
+ fail!(
+ :invalid_issuer,
+ RuntimeError.new(
+ "Issuer does not match. Expected '#{options.platform_issuer_id}', got '#{iss}'.",
+ ),
+ )
+ )
+ end
+
+ if client_id.present? && !options.client_ids.include?(client_id)
+ # client_id is an optional parameter. If present, it must be correct
+ return(
+ fail!(
+ :invalid_client_id,
+ RuntimeError.new(
+ "Client ID does not match. Expected one of '#{options.client_ids.join(",")}', got '#{client_id}'.",
+ ),
+ )
+ )
+ elsif !client_id.present? && options.client_ids.size > 1
+ # We require it if multiple client_ids have been configured
+ return(
+ fail!(
+ :missing_client_id,
+ RuntimeError.new(
+ "client_id parameter not passed, and multiple allowed client_ids are configured",
+ ),
+ )
+ )
+ elsif !client_id.present?
+ client_id = options.client_ids.first
+ end
+
+ state = SecureRandom.hex
+ nonce = SecureRandom.hex
+
+ session["omniauth.state"] = state
+ session["omniauth.nonce"] = nonce
+ session["destination_url"] = target_link_uri
+
+ params = {
+ scope: "openid",
+ response_type: "id_token",
+ response_mode: "form_post",
+ prompt: "none",
+ client_id: client_id,
+ redirect_uri: callback_url,
+ login_hint: login_hint,
+ state: state,
+ nonce: nonce,
+ }
+
+ params[:lti_message_hint] = lti_message_hint if lti_message_hint
+
+ redirect "#{options.authorize_url}?#{params.to_query}"
+ end
+
+ def callback_call
+ return resubmit_as_samesite(:error, :state, :id_token) if cross_site_post?
+ super
+ end
+
+ def callback_phase
+ if error = request.params["error"]
+ return(
+ fail! error,
+ CallbackError.new(
+ request.params["error"],
+ request.params["error_description"],
+ request.params["error_uri"],
+ )
+ )
+ elsif request.params["state"].to_s.empty?
+ return(
+ fail! :state_missing, StandardError.new("State parameter was not included in the callback")
+ )
+ elsif request.params["id_token"].to_s.empty?
+ return(
+ fail! :id_token_missing,
+ StandardError.new("id_token parameter was not included in the callback")
+ )
+ elsif request.params["state"] != session["omniauth.state"]
+ return(fail! :state_mismatch, StandardError.new("State parameter did not match the session"))
+ elsif id_token_info["nonce"] != session["omniauth.nonce"]
+ return(fail! :nonce_mismatch, StandardError.new("Nonce claim did not match the session"))
+ elsif [*id_token_info["aud"]].length > 1 && !options.client_ids.include(id_token_info["azp"])
+ # If the ID Token contains multiple audiences, the Tool SHOULD verify that an azp Claim is present;
+ # If an azp (authorized party) Claim is present, the Tool SHOULD verify that its client_id is the Claim's value;
+ return(
+ fail! :azp_mismatch,
+ StandardError.new(
+ "azp claim invalid. Expected one of #{options.client_ids.join(",")}, received #{id_token_info["azp"]}",
+ )
+ )
+ end
+
+ super
+ rescue ::JWT::DecodeError => e
+ fail! :token_invalid, e
+ end
+
+ def on_auth_path?
+ super || on_initiate_path?
+ end
+
+ def on_initiate_path?
+ on_path?("#{path_prefix}/#{name}/initiate")
+ end
+
+ def cross_site_post?
+ request.request_method.downcase.to_sym == :post && request.params["samesite"].nil?
+ end
+
+ def resubmit_as_samesite(*params)
+ form_fields =
+ params
+ .filter_map do |param_name|
+ next if request.params[param_name.to_s].nil?
+ escaped_value = Rack::Utils.escape_html request.params[param_name.to_s]
+ "<input type='hidden' name='#{param_name}' value='#{escaped_value}'/>"
+ end
+ .join("\n")
+
+ response_headers = { "Content-Type" => "text/html; charset=UTF-8" }
+
+ script_path = "/plugins/discourse-lti/javascripts/submit-on-load-lti.js"
+ html = <<~HTML
+ <html>
+ <head>
+ <script src="#{UrlHelper.absolute(script_path, GlobalSetting.cdn_url)}" nonce="#{ContentSecurityPolicy.try(:nonce_placeholder, response_headers)}"></script>
+ </head>
+ <body>
+ <form method="post">
+ <input type='hidden' name='samesite' value='true'/>
+ #{form_fields}
+ <noscript>
+ <input type="submit" value="Continue"/>
+ </noscript>
+ </form>
+ </body>
+ </html>
+ HTML
+
+ r = Rack::Response.new(html, 200, response_headers)
+ r.finish
+ end
+
+ def id_token_info
+ @id_token_info ||= decode_token(request.params["id_token"])
+ end
+
+ def decode_token(token)
+ payload, header =
+ ::JWT.decode(
+ request.params["id_token"],
+ public_key,
+ true,
+ {
+ algorithm: "RS256",
+ verify_expiration: true,
+ verify_not_before: true,
+ iss: options.platform_issuer_id,
+ verify_iss: true,
+ aud: options.client_ids,
+ verify_aud: true,
+ },
+ )
+
+ payload
+ end
+
+ def raw_public_key
+ raw = options.platform_public_key
+ if raw.start_with?("-----BEGIN")
+ raw
+ else
+ "-----BEGIN PUBLIC KEY-----\n#{raw}\n-----END PUBLIC KEY-----"
+ end
+ end
+
+ def public_key
+ @public_key ||= OpenSSL::PKey::RSA.new raw_public_key
+ end
+
+ uid { id_token_info["sub"] }
+
+ info do
+ {
+ name: id_token_info["name"],
+ email: id_token_info["email"],
+ first_name: id_token_info["given_name"],
+ last_name: id_token_info["family_name"],
+ nickname: id_token_info["preferred_username"],
+ image: id_token_info["picture"],
+ }
+ end
+
+ extra { { raw_info: id_token_info, id_token: request.params["id_token"] } }
+
+ def callback_url
+ full_host + script_name + callback_path
+ end
+end
diff --git a/plugins/discourse-lti/plugin.rb b/plugins/discourse-lti/plugin.rb
new file mode 100644
index 00000000000..99d43cf167c
--- /dev/null
+++ b/plugins/discourse-lti/plugin.rb
@@ -0,0 +1,76 @@
+# frozen_string_literal: true
+
+# name: discourse-lti
+# about: Allows login integration with a number of learning management systems via the LTI 1.3 standard.
+# meta_topic_id: 196174
+# version: 1.0
+# authors: David Taylor
+# url: https://github.com/discourse/discourse/tree/main/plugins/discourse-lti
+
+enabled_site_setting :lti_enabled
+
+module ::DiscourseLti
+ PLUGIN_NAME = "discourse-lti"
+ CUSTOM_DATA_CLAIM = "https://purl.imsglobal.org/spec/lti/claim/custom"
+ DISCOURSE_INVITE_KEYS = %w[discourse_invite_link custom_discourse_invite_link] # Coursera prefixes keys with `custom_`
+
+ class ShouldReconnect < StandardError
+ end
+end
+
+after_initialize do
+ # Check for invite URL in LTI custom fields
+ # If present, and this is a new user, redirect the user to the invite url.
+ # Otherwise, continue as normal
+ on(:after_auth) do |authenticator, auth_result, session|
+ next if !(authenticator.name.to_sym == :lti)
+ next if auth_result.user # Only redirect new users to invite
+
+ uaa =
+ UserAssociatedAccount.find_by(
+ provider_name: "lti",
+ provider_uid: auth_result.extra_data[:uid],
+ )
+ next if uaa.nil?
+
+ custom_data = uaa.extra.dig("raw_info", ::DiscourseLti::CUSTOM_DATA_CLAIM)
+ next if custom_data.nil?
+
+ invite = nil
+ ::DiscourseLti::DISCOURSE_INVITE_KEYS.each { |k| break if invite = custom_data[k] }
+ next if invite.nil?
+
+ parsed =
+ begin
+ URI.parse(invite)
+ rescue URI::Error
+ next
+ end
+ next if parsed.nil?
+ next if parsed.host && parsed.host != Discourse.current_hostname
+
+ route = Discourse.route_for(parsed.path)
+ next if !(route[:controller] == "invites" && route[:action] == "show")
+
+ session[:destination_url] = parsed.to_s
+ end
+
+ on(:after_auth) do |authenticator, auth_result, session, cookies|
+ next if !(authenticator.name.to_sym == :lti)
+ if !auth_result.user && cookies["_t"] # User (probably) already logged in
+ raise ::DiscourseLti::ShouldReconnect.new
+ end
+ end
+
+ reloadable_patch do
+ ::Users::OmniauthCallbacksController.rescue_from(::DiscourseLti::ShouldReconnect) do
+ session[:auth_reconnect] = true
+ complete
+ end
+ end
+end
+
+require_relative "lib/discourse_lti/lti_omniauth_strategy"
+require_relative "lib/discourse_lti/lti_authenticator"
+
+auth_provider authenticator: ::DiscourseLti::LtiAuthenticator.new
diff --git a/plugins/discourse-lti/public/javascripts/submit-on-load-lti.js b/plugins/discourse-lti/public/javascripts/submit-on-load-lti.js
new file mode 100644
index 00000000000..55f43a1be4e
--- /dev/null
+++ b/plugins/discourse-lti/public/javascripts/submit-on-load-lti.js
@@ -0,0 +1,3 @@
+window.onload = function () {
+ document.forms[0].submit();
+};
diff --git a/plugins/discourse-lti/spec/requests/lti_spec.rb b/plugins/discourse-lti/spec/requests/lti_spec.rb
new file mode 100644
index 00000000000..5acfc924648
--- /dev/null
+++ b/plugins/discourse-lti/spec/requests/lti_spec.rb
@@ -0,0 +1,225 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+
+describe "LTI Plugin" do
+ let(:authorize_url) { "https://example.com/authorize" }
+ let(:platform_private_key) { OpenSSL::PKey::RSA.generate 2048 }
+ let(:platform_public_key) { platform_private_key.public_key }
+ let(:platform_issuer_id) { "https://example.com" }
+ let(:tool_client_id) { "toolclientid" }
+
+ let(:init_params) do
+ {
+ iss: platform_issuer_id,
+ login_hint: "loginhint",
+ target_link_uri: "/t/123",
+ lti_message_hint: "messagehint",
+ }
+ end
+
+ before do
+ SiteSetting.lti_enabled = true
+ SiteSetting.lti_authorization_endpoint = authorize_url
+ SiteSetting.lti_platform_public_key = platform_public_key.to_s
+ SiteSetting.lti_platform_issuer_id = platform_issuer_id
+ SiteSetting.lti_client_ids = tool_client_id
+ SiteSetting.lti_email_verified = true
+ end
+
+ it "shows an error if auth is started on Discourse side" do
+ post "/auth/lti"
+ expect(response.status).to eq(302)
+ expect(response.location).to eq("/auth/failure?message=third_party_only&strategy=lti")
+ end
+
+ describe "#initiate" do
+ it "works with GET" do
+ get "/auth/lti/initiate", params: init_params
+ expect(response.status).to eq(302)
+ expect(response.location).to start_with(authorize_url)
+ expect(response.location).to include(
+ tool_client_id,
+ "loginhint",
+ "messagehint",
+ "state=",
+ "nonce=",
+ )
+ end
+
+ it "converts cross-site POST to same-site POST" do
+ # We use SameSite=None session cookies, so the browser will not send them
+ # in a cross-site POST. To work around this, we render a form with all the
+ # same params, then auto-submit it. This ensures the correct session cookie
+ # will be sent by the browser
+ post "/auth/lti/initiate", params: init_params
+ expect(response.status).to eq(200)
+ expect(response.headers["Content-Type"]).to eq("text/html; charset=UTF-8")
+ expect(response.body).to include '<form method="post">',
+ "<input type='hidden' name='samesite' value='true'/>",
+ "<input type='hidden' name='iss' value='#{Rack::Utils.escape_html(platform_issuer_id)}'/>",
+ "<input type='hidden' name='login_hint' value='loginhint'/>",
+ "<input type='hidden' name='lti_message_hint' value='messagehint'/>"
+ end
+
+ it "works with POST" do
+ post "/auth/lti/initiate", params: init_params.merge(samesite: "true")
+ expect(response.status).to eq(302)
+ expect(response.location).to start_with(authorize_url)
+ expect(response.location).to include(
+ tool_client_id,
+ "loginhint",
+ "messagehint",
+ "state=",
+ "nonce=",
+ )
+ end
+
+ it "verifies the client_id if present" do
+ get "/auth/lti/initiate", params: init_params.merge(client_id: tool_client_id)
+ expect(response.status).to eq(302)
+ expect(response.location).to start_with(authorize_url)
+
+ get "/auth/lti/initiate", params: init_params.merge(client_id: "incorrect_client_id")
+ expect(response.status).to eq(302)
+ expect(response.location).to include("message=invalid_client_id")
+ end
+
+ it "requires client_id parameter if multiple are configured" do
+ SiteSetting.lti_client_ids = "#{tool_client_id}|anotherkey"
+ get "/auth/lti/initiate", params: init_params
+ expect(response.status).to eq(302)
+ expect(response.location).to include("message=missing_client_id")
+ end
+
+ it "verifies the client_id if multiple are configured" do
+ SiteSetting.lti_client_ids = "#{tool_client_id}|anotherkey"
+ get "/auth/lti/initiate", params: init_params.merge(client_id: "anotherkey")
+ expect(response.status).to eq(302)
+ expect(response.location).to start_with(authorize_url)
+ end
+ end
+
+ describe "#callback" do
+ let(:initialize_response) do
+ get "/auth/lti/initiate", params: init_params
+ expect(response.status).to eq(302)
+ response.location
+ end
+ let(:state) { initialize_response[/state=([a-z0-9]+)/, 1] }
+ let(:nonce) { initialize_response[/nonce=([a-z0-9]+)/, 1] }
+
+ let(:token_data) do
+ {
+ sub: "myuid",
+ iss: platform_issuer_id,
+ nonce: nonce,
+ exp: 1.hour.from_now.to_i,
+ aud: tool_client_id,
+ email: "[email protected]",
+ }
+ end
+ let(:id_token) { JWT.encode(token_data, platform_private_key, "RS256") }
+
+ let(:callback_params) { { id_token: id_token, state: state } }
+
+ it "converts cross-site POST to same-site POST" do
+ post "/auth/lti/callback", params: callback_params
+ expect(response.status).to eq(200)
+ expect(response.headers["Content-Type"]).to eq("text/html; charset=UTF-8")
+ expect(response.body).to include '<form method="post">',
+ "<input type='hidden' name='samesite' value='true'/>",
+ "<input type='hidden' name='id_token' value='#{Rack::Utils.escape_html(id_token)}'/>",
+ "<input type='hidden' name='state' value='#{state}'/>"
+ end
+
+ it "works correctly" do
+ post "/auth/lti/callback", params: callback_params.merge(samesite: "true")
+ expect(response.status).to eq(302)
+ expect(response.location).to include("/t/123")
+ data = JSON.parse(cookies[:authentication_data])
+ expect(data["email"]).to eq("[email protected]")
+ end
+
+ it "works without PEM prefix/suffix" do
+ SiteSetting.lti_platform_public_key =
+ SiteSetting.lti_platform_public_key.gsub(/^-.*-$/) { "" }.strip
+
+ post "/auth/lti/callback", params: callback_params.merge(samesite: "true")
+ expect(response.status).to eq(302)
+ expect(response.location).to include("/t/123")
+ data = JSON.parse(cookies[:authentication_data])
+ expect(data["email"]).to eq("[email protected]")
+ end
+
+ it "fails if state does not match" do
+ callback_params[:state] = "blah"
+ post "/auth/lti/callback", params: callback_params.merge(samesite: "true")
+ expect(response.status).to eq(302)
+ expect(response.location).to include("/auth/failure?message=state_mismatch")
+ end
+
+ it "fails if nonce does not match" do
+ token_data[:nonce] = "blah"
+ post "/auth/lti/callback", params: callback_params.merge(samesite: "true")
+ expect(response.status).to eq(302)
+ expect(response.location).to include("/auth/failure?message=nonce_mismatch")
+ end
+
+ it "fails if audience does not match" do
+ token_data[:aud] = "blah"
+ post "/auth/lti/callback", params: callback_params.merge(samesite: "true")
+ expect(response.status).to eq(302)
+ expect(response.location).to include("/auth/failure?message=token_invalid")
+ end
+
+ it "fails if signature is wrong" do
+ different_certificate = OpenSSL::PKey::RSA.generate 2048
+ callback_params[:id_token] = JWT.encode token_data, different_certificate, "RS256"
+ post "/auth/lti/callback", params: callback_params.merge(samesite: "true")
+ expect(response.status).to eq(302)
+ expect(response.location).to include("/auth/failure?message=token_invalid")
+ end
+
+ it "fails if token expired" do
+ token_data[:exp] = 1.hour.ago.to_i
+ post "/auth/lti/callback", params: callback_params.merge(samesite: "true")
+ expect(response.status).to eq(302)
+ expect(response.location).to include("/auth/failure?message=token_invalid")
+ end
+
+ context "with invite custom field" do
+ let(:invite) { Invite.generate(Discourse.system_user) }
+ before do
+ token_data[DiscourseLti::CUSTOM_DATA_CLAIM] = {
+ DiscourseLti::DISCOURSE_INVITE_KEYS.first => invite.link,
+ }
+ end
+
+ it "redirects new users to the invite" do
+ post "/auth/lti/callback", params: callback_params.merge(samesite: "true")
+ expect(response.status).to eq(302)
+ expect(response.location).to include(invite.link)
+ data = JSON.parse(cookies[:authentication_data])
+ expect(data["email"]).to eq("[email protected]")
+ end
+
+ it "sends existing users to the launch URL" do
+ Fabricate(:user, email: "[email protected]")
+ post "/auth/lti/callback", params: callback_params.merge(samesite: "true")
+ expect(response.status).to eq(302)
+ expect(response.location).to include("/t/123")
+ end
+ end
+
+ context "when a user is already logged in" do
+ before { sign_in Fabricate(:user) }
+
+ it "automatically goes into auth_reconnect mode" do
+ post "/auth/lti/callback", params: callback_params.merge(samesite: "true")
+ expect(response.status).to eq(302)
+ expect(response.location).to include("/associate/")
+ end
+ end
+ end
+end
diff --git a/plugins/discourse-lti/spec/system/core_features_spec.rb b/plugins/discourse-lti/spec/system/core_features_spec.rb
new file mode 100644
index 00000000000..db86db283bd
--- /dev/null
+++ b/plugins/discourse-lti/spec/system/core_features_spec.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+RSpec.describe "Core features", type: :system do
+ before { enable_current_plugin }
+
+ it_behaves_like "having working core features"
+end
diff --git a/translator.yml b/translator.yml
index 480ef0c3e09..225455722be 100644
--- a/translator.yml
+++ b/translator.yml
@@ -130,6 +130,13 @@ files:
destination_path: plugins/login-with-amazon/server.yml
label: login-with-amazon
+ - source_path: plugins/discourse-lti/config/locales/client.en.yml
+ destination_path: plugins/lti/client.yml
+ label: lti
+ - source_path: plugins/discourse-lti/config/locales/server.en.yml
+ destination_path: plugins/lti/server.yml
+ label: lti
+
- source_path: plugins/discourse-microsoft-auth/config/locales/client.en.yml
destination_path: plugins/microsoft-auth/client.yml
label: microsoft-auth