Skip to content

[LTI Provider] Basic LTI authentication - #8347

Merged
ormsbee merged 1 commit into
openedx:masterfrom
mcgachey:mcgachey-lti-authentication
Jun 11, 2015
Merged

[LTI Provider] Basic LTI authentication#8347
ormsbee merged 1 commit into
openedx:masterfrom
mcgachey:mcgachey-lti-authentication

Conversation

@mcgachey

@mcgachey mcgachey commented Jun 3, 2015

Copy link
Copy Markdown
Contributor

This change cleans up the work in progress request at https://github.com/edx/edx-platform/pull/8176

This is an initial authentication implementation that allows LTI users to log in transparently to
edX. The behavior is driven by pilot users at Harvard; this was the most requested feature.

The patch creates a new database model that maps users' LTI identifiers to newly-created edX
accounts. If an LTI launch comes in with a user_id field that is not in the database, a new edX
account is created with a random user name and password. This account is then stored in the database,
so that it is permanently associated with the LTI user ID.

This patch takes a simplistic approach to session management. If a user is logged in with a
different account when they perform an LTI launch, they will be logged out and then re-logged
in using their LTI account.

In order to keep the patch simple, I have split out some refactoring that needs to be done into
a separate branch that I'll post once this has been merged. Since we no longer redirect to the
login page, we don't need to maintain two separate LTI endpoints (one for the LTI launch and
one for authenticated users), or deal with the session management that requires. There are
also multiple fetches of the LtiConsumer object (one in the view, one in the signature
validation) that the later patch will consolidate into one.

This change cleans up the work in progress request at https://github.com/edx/edx-platform/pull/8176

This is an initial authentication implementation that allows LTI users to log in transparently to
edX. The behavior is driven by pilot users at Harvard; this was the most requested feature.

The patch creates a new database model that maps users' LTI identifiers to newly-created edX
accounts. If an LTI launch comes in with a user_id field that is not in the database, a new edX
account is created with a random user name and password. This account is then stored in the database,
so that it is permanently associated with the LTI user ID.

This patch takes a simplistic approach to session management. If a user is logged in with a
different account when they perform an LTI launch, they will be logged out and then re-logged
in using their LTI account.

In order to keep the patch simple, I have split out some refactoring that needs to be done into
a separate branch that I'll post once this has been merged. Since we no longer redirect to the
login page, we don't need to maintain two separate LTI endpoints (one for the LTI launch and
one for authenticated users), or deal with the session management that requires. There are
also multiple fetches of the LtiConsumer object (one in the view, one in the signature
validation) that the later patch will consolidate into one.
@openedx-webhooks

Copy link
Copy Markdown

Thanks for the pull request, @mcgachey! I've created OSPR-628 to keep track of it in JIRA. JIRA is a place for product owners to prioritize feature reviews by the engineering development teams.

Feel free to add as much of the following information to the ticket:

  • supporting documentation
  • edx-code email threads
  • timeline information ('this must be merged by XX date', and why that is)
  • partner information ('this is a course on edx.org')
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will still be done via the Github pull request interface. As a reminder, our process documentation is here.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U needs triage labels Jun 3, 2015
@sarina

sarina commented Jun 3, 2015

Copy link
Copy Markdown
Contributor

@mcgachey - does this replace #8176?

@mcgachey

mcgachey commented Jun 3, 2015

Copy link
Copy Markdown
Contributor Author

@sarina - that's right. I'll close off 8176 and point it here instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If the above try block actually fails, doesn't this fail as well (because edx_user would be undefined)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The try block is in a loop which won't exit until edx_user is created.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ack. Brain did not parse indentation. Thank you.

@ormsbee

ormsbee commented Jun 11, 2015

Copy link
Copy Markdown
Contributor

If I'm logged into the system as myself, then later I view a problem via LTI, am I still logged in as that LTI user when I go back to edx.org in my browser?

@mcgachey

Copy link
Copy Markdown
Contributor Author

You will be. We don't know when a user's done with their work from an LTI launch, so we can't log them out reliably. For the use case on a dedicated system that's OK, but I'm hoping that the working group who are looking into the more general case will have a better solution.

@ormsbee

ormsbee commented Jun 11, 2015

Copy link
Copy Markdown
Contributor

Is there anyway to run the links into a sub-domain (i.e. so that the session is local to something like lti.courses.edx.org) and doesn't trample sessions for typical users?

@mcgachey

Copy link
Copy Markdown
Contributor Author

I don't know enough about the deployment setup to say. Is that something that would be configured in the code or when the server is run?

@ormsbee

ormsbee commented Jun 11, 2015

Copy link
Copy Markdown
Contributor

@chrisndodge: When you're logged into a microsite with a completely different URL from edX, the sessions don't carry over, do they?

@sarina

sarina commented Jun 11, 2015

Copy link
Copy Markdown
Contributor

Based on my research, sometimes they do and sometimes they don't. I'll chat
you.

On Thu, Jun 11, 2015 at 1:34 PM, David Ormsbee notifications@github.com
wrote:

@chrisndodge https://github.com/chrisndodge: When you're logged into a
microsite with a completely different URL from edX, the sessions don't
carry over, do they?


Reply to this email directly or view it on GitHub
https://github.com/edx/edx-platform/pull/8347#issuecomment-111216480.

@chrisndodge

Copy link
Copy Markdown
Contributor

If the micro site is on subdomain, then yes, if it's on its own fully qualified hostname like mitprofessionalx.mit.edu then no.

Sent from my iPhone

On Jun 11, 2015, at 1:34 PM, David Ormsbee notifications@github.com wrote:

@chrisndodge: When you're logged into a microsite with a completely different URL from edX, the sessions don't carry over, do they?


Reply to this email directly or view it on GitHub.

@ormsbee

ormsbee commented Jun 11, 2015

Copy link
Copy Markdown
Contributor

👍

@ormsbee

ormsbee commented Jun 11, 2015

Copy link
Copy Markdown
Contributor

Not an issue for this PR, but in the future, could you please try wrapping your commit messages at 72 lines? It just shows up nicer in some tools and in GitHub.

ormsbee pushed a commit that referenced this pull request Jun 11, 2015
[LTI Provider] Basic LTI authentication
@ormsbee
ormsbee merged commit fb491bf into openedx:master Jun 11, 2015
@benpatterson

Copy link
Copy Markdown
Contributor

Apologies. But this merge has broken master. Here's a link to the build. https://build.testeng.edx.org/job/edx-platform-all-tests-master-flow/746/

I can't tell you what the issue is...whether a rebase will solve it (or expose it for you) or if there needs to be more resilience in the related tests, etc.... but I will be reverting it shortly.

@mcgachey @ormsbee

@mcgachey

Copy link
Copy Markdown
Contributor Author

@benpatterson - Please do go ahead and revert it; I hadn't realized that it would be merged tonight. Some existing tests were refactored in PR https://github.com/edx/edx-platform/pull/8240 that went in after this PR was submitted. I'll rebase and fix the conflicts in the morning.

@benpatterson

Copy link
Copy Markdown
Contributor

Solid. Thanks, @mcgachey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

engineering review open-source-contribution PR author is not from Axim or 2U

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants