Home
News
Forum
Wiki
Blog
Contents
Gallery
Movies
Downloads
About NSL
[
List of Titles
|
List of Pages
|
New
|
Search
|
Recent changes
|
Help
]
Moodle/Moodle-LTI
[
Front page
]
[ ]
Start:
** Hack for [[Moodle]] - [[LTI]]
- [[Moodle+JupyterHub]]
- [[Moodle]], [[JupyterHub]]
- [[LTI]]
#br
*** iframe を使用すると,chrome, edgeでは 405 : Method No...
- SameSite=Lax であるため,iframe 使用時は Moodleのホスト...
#br
**** JupyterHub の log
- 返されたステータス
-- 302 POST
-- 302 GET (通常はここで 200が返る)
-- 302 GET
-- 405 GET
#br
**** ソースコード トレース (数字はトレース順)
- ltiauthenticator/lti11/auth.py
-- 0. authenticate()
- jupyterhub/handlers/base.py
-- 4. login_user() self.current_user -> None
-- 5. self.get_current_user_cookie()
-- 6. self._user_for_cookie() cookie_id-> None cookie...
- tornado/web.py
-- 1. _unimplemented_method() HTTPError(405) を返す
-- 2. wrapper() で 302 が返る.通常なら 200 が返るはず.
-- 3. self.current_user -> None
-- 7. get_secure_cookie() ''結局,jupyterhub-hub-login...
#br
**** Moodle ホスト上で,JupyterHub へ接続するための feser...
- cookie が送信されない理由について推測が正しいならば,Mo...
- feserver のSSLのサーバ証明書で手こずったが,Apacheで使...
- chrome, edge でも iframe の埋め込みが問題なく動作.
- でも問題点を確認したのみで,解決にはなっていない.
- ''問題点: Moodleと JupyterHubを別のホストで動かすと,i...
#br
**** 解決方法
c.JupyterHub.tornado_settings = {
"headers":{ "Content-Security-Policy": "frame-ancest...
"cookie_options": {"SameSite": "None", "Secure": Tru...
}
c.Spawner.args = ['--NotebookApp.tornado_settings={
"headers":{"Content-Security-Policy": "frame-anc...
"cookie_options": { "SameSite": "None", "Secure"...
}'
]
**** 参考:DB
MariaDB [moodle_db]> show columns from mdl_lti;
+-------------------------------+--------------+------+-...
| Field | Type | Null | ...
+-------------------------------+--------------+------+-...
| id | bigint(10) | NO | ...
| course | bigint(10) | NO | ...
| name | varchar(255) | NO | ...
| intro | longtext | YES | ...
| introformat | smallint(4) | YES | ...
| timecreated | bigint(10) | NO | ...
| timemodified | bigint(10) | NO | ...
| typeid | bigint(10) | YES | ...
| toolurl | longtext | NO | ...
| securetoolurl | longtext | YES | ...
| instructorchoicesendname | tinyint(1) | YES | ...
| instructorchoicesendemailaddr | tinyint(1) | YES | ...
| instructorchoiceallowroster | tinyint(1) | YES | ...
| instructorchoiceallowsetting | tinyint(1) | YES | ...
| instructorcustomparameters | longtext | YES | ...
| instructorchoiceacceptgrades | tinyint(1) | YES | ...
| grade | bigint(10) | NO | ...
| launchcontainer | tinyint(2) | NO | ...
| resourcekey | varchar(255) | YES | ...
| password | varchar(255) | YES | ...
| debuglaunch | tinyint(1) | NO | ...
| showtitlelaunch | tinyint(1) | NO | ...
| showdescriptionlaunch | tinyint(1) | NO | ...
| servicesalt | varchar(40) | YES | ...
| icon | longtext | YES | ...
| secureicon | longtext | YES | ...
+-------------------------------+--------------+------+-...
<option value="1" selected="">デフォルト</opt...
<option value="2">埋め込み</option>
<option value="3">埋め込み (ブロックなし)</op...
<option value="5">既存のウィンドウ</option>
<option value="4">新しいウィンドウ</option>
*** [[JupyterHub]] の Swapner での LTI 情報の受け取り処理
- jupyterhub_config.py
import os
os.environ['JUPYTERHUB_CRYPT_KEY'] = 'c283a5e73c8f74cdc8...
.......
.......
def userdata_hook(self, auth_state):
print("AURTH")
print(auth_state)
.......
.......
c.Spawner.auth_state_hook = ProjectDockerSpawner.userdat...
c.Authenticator.enable_auth_state = True
- 環境変数 JUPYTERHUB_CRYPT_KEY の設定が必要
-- キーは openssl rand -hex 32 で生成(Moodle側と一致させ...
#br
**** JupyterHub へのパラメータ送信
- Moodleの外部ツールの設定で,「一般」の「さらに表示する...
-- ''XXX=ZZZ'' と入力すると,上記方法で ''{'costom_xxx': ...
-- # - などの特殊文字は ''_'' になる.''snake_case'' と言...
- 予約語
-- next=
#br
*** [[JupyterHub]] が [[Moodle]] から受け取ったデータ
- 一般的に認証モジュールが引数として受け取る値
{
'user_id': '2',
'lis_person_sourcedid': '',
'roles': 'Instructor,urn:lti:sysrole:ims/lis/Administr...
'context_id': '98',
'context_label': 'JupyterHub-devel',
'context_title': 'JupyterHub 開発',
'resource_link_title': 'JupyterHub',
'resource_link_description': '',
'resource_link_id': '11',
'context_type': 'CourseSection',
'lis_course_section_sourcedid': '',
'lis_result_sourcedid': '{
"data":{
"instanceid":"11",
"userid":"2",
"typeid":"2",
"launchid":1442412989
},
"hash":"a526aa576887b4dc19c16107e9ac7b0dbc92f852e23f...
}',
'lis_outcome_service_url': 'https://el.mml.tuis.ac.jp/...
'lis_person_name_given': 'Admin',
'lis_person_name_family': '管理ユーザ',
'lis_person_name_full': 'Admin 管理ユーザ',
'ext_user_username': 'admin',
'lis_person_contact_email_primary': 'fumi.hax@gmail.co...
'launch_presentation_locale': 'ja',
'ext_lms': 'moodle-2',
'tool_consumer_info_product_family_code': 'moodle',
'tool_consumer_info_version': '2020110902',
'lti_version': 'LTI-1p0',
'lti_message_type': 'basic-lti-launch-request',
'tool_consumer_instance_guid': '5384b0f81508b987c188b1...
'tool_consumer_instance_name': 'EL MML',
'tool_consumer_instance_description':
'e-Learning of MML',
'custom_mdl_user': '*',
'custom_mdl_teacher': 'iseki, admin',
'custom_mdl_image': 'jupyterhub/singleuser-mdl2 : late...
'custom_mdl_suburl': '',
'custom_mdl_sessioninfo': '3,11',
'custom_mdl_vol_zzzz': '課題2',
'custom_mdl_vol_iseki': 'へへへ',
'custom_mdl_vol_jogrid': 'へへへ',
'custom_mdl_vol_': 'えええええええ',
'custom_mdl_vol_hhhhhggjjj': 'あああ',
'custom_mdl_vol_xxxx': 'いいいい',
'custom_mdl_sub_xxxx': '課題提出場所',
'custom_md_teacher': 'iseki',
'custom_ssss': '777',
'custom_zzzz': '',
'launch_presentation_document_target': 'window',
'launch_presentation_return_url': 'https://el.mml.tuis...
}
#br
** Moodle DB
*** LTIの typeid (External Tool 情報) を格納するテーブル
MariaDB [moodle_db]> select id, name,baseurl,tooldomain,...
+----+------------------+-------------------------------...
| id | name | baseurl ...
+----+------------------+-------------------------------...
| 3 | antares:443 | https://antares.nsl.tuis.ac.jp...
| 4 | GITLAB:FE 8100 | https://gitlab.nsl.tuis.ac.jp:...
| 10 | procyon:443 | https://jupyterhub.nsl.tuis.ac...
| 12 | JupyterHub00:443 | https://jupyterhub00.nsl.tuis....
| 13 | JupyterHub01:443 | https://jupyterhub01.nsl.tuis....
| 14 | JupyterHub02:443 | https://jupyterhub02.nsl.tuis....
| 15 | JupyterHub03:443 | https://jupyterhub03.nsl.tuis....
| 19 | antares:8000 | https://antares.nsl.tuis.ac.jp...
| 20 | aldebaran:443 | https://aldebaran.nsl.tuis.ac....
+----+------------------+-------------------------------...
- tooldomain は baseurl から抽出したようだ.
- clientid ???
#br
End:
** Hack for [[Moodle]] - [[LTI]]
- [[Moodle+JupyterHub]]
- [[Moodle]], [[JupyterHub]]
- [[LTI]]
#br
*** iframe を使用すると,chrome, edgeでは 405 : Method No...
- SameSite=Lax であるため,iframe 使用時は Moodleのホスト...
#br
**** JupyterHub の log
- 返されたステータス
-- 302 POST
-- 302 GET (通常はここで 200が返る)
-- 302 GET
-- 405 GET
#br
**** ソースコード トレース (数字はトレース順)
- ltiauthenticator/lti11/auth.py
-- 0. authenticate()
- jupyterhub/handlers/base.py
-- 4. login_user() self.current_user -> None
-- 5. self.get_current_user_cookie()
-- 6. self._user_for_cookie() cookie_id-> None cookie...
- tornado/web.py
-- 1. _unimplemented_method() HTTPError(405) を返す
-- 2. wrapper() で 302 が返る.通常なら 200 が返るはず.
-- 3. self.current_user -> None
-- 7. get_secure_cookie() ''結局,jupyterhub-hub-login...
#br
**** Moodle ホスト上で,JupyterHub へ接続するための feser...
- cookie が送信されない理由について推測が正しいならば,Mo...
- feserver のSSLのサーバ証明書で手こずったが,Apacheで使...
- chrome, edge でも iframe の埋め込みが問題なく動作.
- でも問題点を確認したのみで,解決にはなっていない.
- ''問題点: Moodleと JupyterHubを別のホストで動かすと,i...
#br
**** 解決方法
c.JupyterHub.tornado_settings = {
"headers":{ "Content-Security-Policy": "frame-ancest...
"cookie_options": {"SameSite": "None", "Secure": Tru...
}
c.Spawner.args = ['--NotebookApp.tornado_settings={
"headers":{"Content-Security-Policy": "frame-anc...
"cookie_options": { "SameSite": "None", "Secure"...
}'
]
**** 参考:DB
MariaDB [moodle_db]> show columns from mdl_lti;
+-------------------------------+--------------+------+-...
| Field | Type | Null | ...
+-------------------------------+--------------+------+-...
| id | bigint(10) | NO | ...
| course | bigint(10) | NO | ...
| name | varchar(255) | NO | ...
| intro | longtext | YES | ...
| introformat | smallint(4) | YES | ...
| timecreated | bigint(10) | NO | ...
| timemodified | bigint(10) | NO | ...
| typeid | bigint(10) | YES | ...
| toolurl | longtext | NO | ...
| securetoolurl | longtext | YES | ...
| instructorchoicesendname | tinyint(1) | YES | ...
| instructorchoicesendemailaddr | tinyint(1) | YES | ...
| instructorchoiceallowroster | tinyint(1) | YES | ...
| instructorchoiceallowsetting | tinyint(1) | YES | ...
| instructorcustomparameters | longtext | YES | ...
| instructorchoiceacceptgrades | tinyint(1) | YES | ...
| grade | bigint(10) | NO | ...
| launchcontainer | tinyint(2) | NO | ...
| resourcekey | varchar(255) | YES | ...
| password | varchar(255) | YES | ...
| debuglaunch | tinyint(1) | NO | ...
| showtitlelaunch | tinyint(1) | NO | ...
| showdescriptionlaunch | tinyint(1) | NO | ...
| servicesalt | varchar(40) | YES | ...
| icon | longtext | YES | ...
| secureicon | longtext | YES | ...
+-------------------------------+--------------+------+-...
<option value="1" selected="">デフォルト</opt...
<option value="2">埋め込み</option>
<option value="3">埋め込み (ブロックなし)</op...
<option value="5">既存のウィンドウ</option>
<option value="4">新しいウィンドウ</option>
*** [[JupyterHub]] の Swapner での LTI 情報の受け取り処理
- jupyterhub_config.py
import os
os.environ['JUPYTERHUB_CRYPT_KEY'] = 'c283a5e73c8f74cdc8...
.......
.......
def userdata_hook(self, auth_state):
print("AURTH")
print(auth_state)
.......
.......
c.Spawner.auth_state_hook = ProjectDockerSpawner.userdat...
c.Authenticator.enable_auth_state = True
- 環境変数 JUPYTERHUB_CRYPT_KEY の設定が必要
-- キーは openssl rand -hex 32 で生成(Moodle側と一致させ...
#br
**** JupyterHub へのパラメータ送信
- Moodleの外部ツールの設定で,「一般」の「さらに表示する...
-- ''XXX=ZZZ'' と入力すると,上記方法で ''{'costom_xxx': ...
-- # - などの特殊文字は ''_'' になる.''snake_case'' と言...
- 予約語
-- next=
#br
*** [[JupyterHub]] が [[Moodle]] から受け取ったデータ
- 一般的に認証モジュールが引数として受け取る値
{
'user_id': '2',
'lis_person_sourcedid': '',
'roles': 'Instructor,urn:lti:sysrole:ims/lis/Administr...
'context_id': '98',
'context_label': 'JupyterHub-devel',
'context_title': 'JupyterHub 開発',
'resource_link_title': 'JupyterHub',
'resource_link_description': '',
'resource_link_id': '11',
'context_type': 'CourseSection',
'lis_course_section_sourcedid': '',
'lis_result_sourcedid': '{
"data":{
"instanceid":"11",
"userid":"2",
"typeid":"2",
"launchid":1442412989
},
"hash":"a526aa576887b4dc19c16107e9ac7b0dbc92f852e23f...
}',
'lis_outcome_service_url': 'https://el.mml.tuis.ac.jp/...
'lis_person_name_given': 'Admin',
'lis_person_name_family': '管理ユーザ',
'lis_person_name_full': 'Admin 管理ユーザ',
'ext_user_username': 'admin',
'lis_person_contact_email_primary': 'fumi.hax@gmail.co...
'launch_presentation_locale': 'ja',
'ext_lms': 'moodle-2',
'tool_consumer_info_product_family_code': 'moodle',
'tool_consumer_info_version': '2020110902',
'lti_version': 'LTI-1p0',
'lti_message_type': 'basic-lti-launch-request',
'tool_consumer_instance_guid': '5384b0f81508b987c188b1...
'tool_consumer_instance_name': 'EL MML',
'tool_consumer_instance_description':
'e-Learning of MML',
'custom_mdl_user': '*',
'custom_mdl_teacher': 'iseki, admin',
'custom_mdl_image': 'jupyterhub/singleuser-mdl2 : late...
'custom_mdl_suburl': '',
'custom_mdl_sessioninfo': '3,11',
'custom_mdl_vol_zzzz': '課題2',
'custom_mdl_vol_iseki': 'へへへ',
'custom_mdl_vol_jogrid': 'へへへ',
'custom_mdl_vol_': 'えええええええ',
'custom_mdl_vol_hhhhhggjjj': 'あああ',
'custom_mdl_vol_xxxx': 'いいいい',
'custom_mdl_sub_xxxx': '課題提出場所',
'custom_md_teacher': 'iseki',
'custom_ssss': '777',
'custom_zzzz': '',
'launch_presentation_document_target': 'window',
'launch_presentation_return_url': 'https://el.mml.tuis...
}
#br
** Moodle DB
*** LTIの typeid (External Tool 情報) を格納するテーブル
MariaDB [moodle_db]> select id, name,baseurl,tooldomain,...
+----+------------------+-------------------------------...
| id | name | baseurl ...
+----+------------------+-------------------------------...
| 3 | antares:443 | https://antares.nsl.tuis.ac.jp...
| 4 | GITLAB:FE 8100 | https://gitlab.nsl.tuis.ac.jp:...
| 10 | procyon:443 | https://jupyterhub.nsl.tuis.ac...
| 12 | JupyterHub00:443 | https://jupyterhub00.nsl.tuis....
| 13 | JupyterHub01:443 | https://jupyterhub01.nsl.tuis....
| 14 | JupyterHub02:443 | https://jupyterhub02.nsl.tuis....
| 15 | JupyterHub03:443 | https://jupyterhub03.nsl.tuis....
| 19 | antares:8000 | https://antares.nsl.tuis.ac.jp...
| 20 | aldebaran:443 | https://aldebaran.nsl.tuis.ac....
+----+------------------+-------------------------------...
- tooldomain は baseurl から抽出したようだ.
- clientid ???
#br
Page:
Site Search
Advanced Search
Login
Username:
Password:
Lost Password?
Register now!!
Sub Menu
New Arrivals
Books
Web Links
Site Map
e-Learning
TUIS Certificate
mini Calendar
May 2025
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Today
Who's Online
117 user(s) are online (6 user(s) are browsing xpwiki)
Members: 0
Guests: 117
more...
Access Counter
Today :
Yesterday :
Total :
Powered by XOOPS Cube 2.1© 2001-2006
XOOPS Cube Project
Design by
XoopsDesign.com