forked from drlippman/IMathAS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
imathasltiplan.txt
122 lines (103 loc) · 3.82 KB
/
imathasltiplan.txt
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
LTI framework plan:
Create parameters:
oauth_version=1.0
oauth_nonce=nonce (eg md5 of microtime + random number)
oauth_timestamp=unix timestamp
oauth_consumer_key=value provided by me
lti_message_type=basic-lti-launch-request
user_id=your local userid (preferably auto database id rather than SID)
optionally can also include:
lis_person_contact_emailprimary=user email address
lis_person_name_first=first name
lis_person_name_last=last name
BLTIlaunchrequest.php listens for launch requests (POST form)
Checks signature on request using OAuth
Required params:
lti_version = LTI-1p0
lti_message_type = basic-lti-launch-request
user_id
tool_consumer_instance_guid (LMS domain name)
roles (instructor or otherwise)
Optionally sent:
resource link id (only really needed for assessment embed for outcome reporting eventually)
lis_person_name_full
or better: lis_person_name_first and _last
lis_person_contact_emailprimary
oauth_consumer_key = cid_###, aid_###, or sso_**** _ 1 or 0
if 1, user accounts on wamap are auto-created using LMS data;
student will never know wamap username/password
if 0 (or left off), asks student to create wamap account linked to LMS account;
can log in SSO from LMS, or log in directly to WAMAP
context_id = LMS course id #
context_title = course name
context_label = course short name (eg MATH142)
oauth_consumer_key triggers action:
cid set:
trigger course embed mode with given course id
aid set:
trigger assessment embed mode with given assessment id
sso set:
trigger system embed mode with given group admin username
in this case, secret used for signing must be MD5 of password, not actual password!
TOCHECK:
will repost have valid signature if additional POSTs? ()
On Launchrequest:
x check LTI enabled
? check for request type
x check for necessary params
x if repost w name,email, etc.: unset before checking signature
x check signature, but don't mark nonce used yet
x if cid or aid request, check availability
x check if already in ltiusers
if not:
if lti_only:
ask for name, email
if not lti_only:
ask if already has account. If not, provide form for it
on submit:
record account info
if yes:
pull their info
x if cid or aid request, check course enrollment; enroll if needed
if session and settings exist already and not aid w timelimit
redirect to resource
if no session exists, or session but no settings:
create session
display accessibility settings
prompt for
JAVA jsp launch:
<html>
<head>
<title>Redirecting..</title>
</head>
<body>
<p>Redirecting to WAMAP.org. If you are not automatically redirected, click the button below</p>
<%@ page import="org.imsglobal.basiclti.BasicLTIUtil" %>
<%@ page import="java.util.Properties" %>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<%
Properties postProp = new Properties();
//for you to implement.
//Only userid is required
String userid = "";
String firstname = "";
String lastname = "";
String email = "";
//these are required. user_id be database userid rather than SID
postProp.setProperty("user_id",userid);
String org_id = "my.tacomacc.net";
String org_desc = "Tacoma Community College Portal";
//these are optional. Remove if not using
postProp.setProperty("lis_person_name_first",firstname);
postProp.setProperty("lis_person_name_last",lastname);
postProp.setProperty("lis_person_contact_email_primary",email);
//provided by me
String endpoint = "http://www.imathas.com/cur/bltilaunch.php";
String key = "sso_";
String secret = " ";
postProp = BasicLTIUtil.signProperties(postProp, endpoint, "POST", key, secret, null, org_id, org_desc);
String postData = BasicLTIUtil.postLaunchHTML(postProp, endpoint, false);
out.println(postData);
&>
</body>
</html>