Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTI Changes #608

Merged
merged 12 commits into from Sep 4, 2015
Merged

LTI Changes #608

merged 12 commits into from Sep 4, 2015

Conversation

goehle
Copy link
Member

@goehle goehle commented Jul 5, 2015

These are some changes I made to get LTI working with the Blackboard server at WCU. In particular

  1. I added a variable which allows you to use the email address to get the username when the username isn't provided. Set $preferred_source_of_username to lis_person_contact_email_primary and $strip_address_from_email = 1. Then when a user is created it will use the username from the email and not the whole email.
  2. I set up the system so that if $LTIBasicToThisSiteURL is not set then the system will try to get the url from the path given in the LTI request. (It will try both the http and https versions.) This can be tested by removing the $LTIBasicToThisSiteURL variable as long as the path in the LTI request and your server address match.

It works on our LTI setup but it would be nice if this could be tested on a few others.

- It looks for a ful urn for the role and removes the "path" portion of it.  I.E it changes urn:lti:role:ims/lis/Learner to Learner

- It now uses the url of the page request as the url for verifying the authentication token.  This means that you can use any valid url in your blackboard course.  This allows you to link directly to homeworks.
- Added a flag which strips the username off of the email.  This is useful for systems, like Blackboard, which doen't provide the username, but you don't want the whole email.
- Added ability for $LTIBasicToThisSiteURL to override the path used to validate the request
@goehle
Copy link
Member Author

goehle commented Jul 9, 2015

BTW: The best way to test this would be with warn statements.

  • Add warn($self->{user_id}) to line 253 of LTIBasic.pm With $preferred_source_of_username set to "lis_person_contact_email_primary" and "$strip_address_from_email" set to 1 you should get only the username. Otherwise you should get the email.
  • Add warn($path) to line 417 of LTIBasic.pm. If $LTIBasicToThisSiteURL is set you should get that value for path. Otherwise it should be automatically constructed from the request.

@pstaabp
Copy link
Sponsor Member

pstaabp commented Jul 10, 2015

I'd be happy to test this. We use blackboard on campus. Do you have some setup instructions that you use for this?

@goehle
Copy link
Member Author

goehle commented Jul 10, 2015

First you need to set up webwork as an LTI through blackboard. I'm not entirely sure how this is done, since I had a blackboard administrator do it for me. I imagine these will help: https://help.blackboard.com/en-us/Learn/9.1_SP_10_and_SP_11/Administrator/120_System_Integration/LTI_Tool_Providers

Next you have to uncomment out the LTI authen line from localOverrides, and copy the LTI authen file from the dist version. For this branch the only thing you need to set is $LTIBasicConsumerSecret, which should be the same as what was set in blackboard.

Next you create a link in a blackboard course to a particular homework set. You should also click the "This link is to a Tool Provider" box. When you click the link it should log you into WeBWorK automatically, and even create student users if they don't exist.

@pstaabp
Copy link
Sponsor Member

pstaabp commented Jul 14, 2015

I'm trying to help our admin person set up blackboard LTI. I sent along the link to http://webwork.maa.org/wiki/LTI-Basic_Authentication

Does the admin person just need the info in in the bottom (the example connecting to the IU site)? What is the URL that they need to add in?

@goehle
Copy link
Member Author

goehle commented Jul 14, 2015

I dont know about those instructions. In particular I thought the domain/url was the url of the LTI site, i.e. of your webwork server. Here is a screen shot of our configuration.

screen_shot_2015-02-27_at_8 17 32_am

@goehle
Copy link
Member Author

goehle commented Jul 14, 2015

Above that there is the url for our webwork site and the consumer secret.

@pstaabp
Copy link
Sponsor Member

pstaabp commented Jul 14, 2015

Is the URL just to /webwork2 or is it to a subdirectory?

@goehle
Copy link
Member Author

goehle commented Jul 14, 2015

I'm pretty sure its just the full url to the webwork2 server. To be fair, I didn't set ours up either. In particular the official instructions are
You can add new tool providers using Register Provider Domain.

  1. On the Administrator Panel, under Building Blocks, click Building Blocks.
    2 . Click LTI Tool Providers.
  2. Click Register Provider Domain.
  3. Type the Provider Domain, such as http://www.example.com.
  4. Select the Provider Domain Status - Approved or Excluded. Approved is the default setting. Selecting Excluded prevents users from adding tool links to that provider.
  5. Optionally, provide any Secondary Hostnames for the provider. The provider can supply this information.
    Tool providers can offer configuration for the entire site, or for each individual link. If the provider allows configuration for the entire site, select Set Globally and type the Tool Provider Key and Tool Provider Secret. Leaving the Default Configuration as Set separately for each link requires users to enter the Key and Secret when creating each link.
  6. Add any custom parameters required by the tool provider in the text box Tool Provider Custom Parameters.
    Each parameter must be on its own line.
    Parameters must be formatted as a "name=value" pair.
    Custom parameters can include template variables that are resolved using data from Learn, in the Learn parameter format @x@ user.full_name @x@. To learn more, see Template Variables.
    The Institution Policies section pulls preferences from the Global Properties. You can manage settings for the individual provider here. Any choices you make for the individual provider override the Global Properties.

So it looks like its just the webwork2 server domain. You don't even need the /webwork2. You can use the global key option if you want your key to be for the whole server, or you can set the key per course using course.conf.

# if you enable this flag and have $preferred_source_of_username set to
# lis_person_contact_email_primary, then webwork will strip off the address
# portion of the email and just use the username.
$strip_address_from_email = 1;
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is odd. This line and the comment above it don't appear in authen_LTI.conf.dist when I pull this request. ?????

-- OK. I fixed it. Something weird I was doing with git I guess.

# lis_person_contact_email_primary, then webwork will strip off the address
# portion of the email and just use the username.

# $strip_address_from_email = 1;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. I commented out this variable by default. (it probably should be). Maybe the new commit will trigger something.

$self->{user_id} = $self -> {email};

}

Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Geoff. Did you mean to leave the if clause above in the code? There is no parameter get_username_from_email in any of the config files that I can find. And this causes somewhat confusing logic. For example if you set
get_username_from_email=1 then you get the full email address for the user_id (no matter what userid LTI provided).
If you set strip_address_from_email =1 then you still get the full address.
If you now set $preferred_source_of_username = "lis_person_contact_email_primary"; you get the stripped address,

My guess is that you want to leave out the get_username_from_email flag and the above snippet out entirely.
Comments?

@goehle
Copy link
Member Author

goehle commented Sep 2, 2015

Good catch. I think that was left over from when I was implementing the ability to get the username from the email before I decided to use the existing flags.

@goehle
Copy link
Member Author

goehle commented Sep 3, 2015

Mike added some extra debug statements. I've tested them and they help out. The various LTI setups are substantially different in terms of what parameters they are passing and what the call the various roles users can have. This should help individual administrators untangle that mess.

Peter, could you try setting up the LTI stuff again. If you add

$debug_lti_parameters = 1; 

to the autthen_LTI.conf file it will print out a bunch of debug info.

mgage and others added 2 commits September 3, 2015 22:36
These error messages are aimed at making it easier to set up the initial communication between WeBWorK and the
LMS calling WeBWorK via LTI.

Also commented out some preliminary code to be used at Rochester for deducing sections from the Blackboard course_label at
UR.

A lot of the authentication procedure is as described in the comments and specific to the needs of IU.  A future update
should breakout the process of assigning recitations and sections into a callback subroutine so that it is easier to
program in different behaviors for handling this task.  This will do for now.
@mgage
Copy link
Sponsor Member

mgage commented Sep 4, 2015

I think this is a reasonable pausing point for now. I can see further improvements that will make installing LTI easier and perhaps increase it's utilities. I think those major improvements should wait until after the 2.11 release.

mgage added a commit that referenced this pull request Sep 4, 2015
@mgage mgage merged commit 8f649d2 into openwebwork:develop Sep 4, 2015
@goehle goehle deleted the ltiups branch January 3, 2016 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants