Skip to content

Conversation

dbhynds
Copy link
Member

@dbhynds dbhynds commented Jan 7, 2021

This PR is admittedly massive, and there's not really any way around it. I'll do my best to categorize the changes I've made:

  • Change the namespace from ImsGlobal to Packback\Lti1p3
  • Rename all classes to StudlyCase and methods to camelCase.
  • Various formatting changes for PSR-0, PSR-1, and PSR-4
  • Implemented interfaces core objects
  • Implemented automated tests
  • Updated the readme
  • Added a Laravel Implementation Guide

Code coverage is currently at 52%. Not great, but it's a lot better than 0. I also ported over our certification tests from PBQ and (with not a small amount of struggling) managed to get the tests implemented for IMS LTI 1.3 Certification.

There are several areas of the code marked with @todo, mostly revolving around testing. If I have time later this sprint, I'll come back to these, but I wanted to get something out there first.

I have a local branch on PBQ that references this one to verify at the very least that nothing I did here breaks anything over there. https://github.com/packbackbooks/questions/tree/lti-13

use \IMSGlobal\LTI;
use Firebase\JWT\JWT;

JWT::$leeway = 5;

Choose a reason for hiding this comment

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

As somebody not familiar with Firebase or the $leeway field, I have no clue what this bootstrapping is doing.

Copy link
Member Author

@dbhynds dbhynds Jan 7, 2021

Choose a reason for hiding this comment

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

That makes two of us 😆

README.md Outdated
- Packback\Lti1p3\Interfaces\Cookie
- Packback\Lti1p3\Interfaces\Database

Cache and Cookie storage have legacy implementations at Packback\Lti1p3\ImsStorage if you do not wish to implement your own. However you must implement your own database.

Choose a reason for hiding this comment

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

Just general thoughts here - are the legacy Packback\Lti1p3\ImsStorage used by default? I don't know what these are doing, but generally it's good for a package to start with "batteries included" and then explain more advanced usages like implementing your own storage mechanism.

Copy link
Member Author

Choose a reason for hiding this comment

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

They're not used by default. Honestly, I'm hesitant to have them used out of the box. They're not the most flexible and make a lot of assumptions about implementation. For example, Laravel's Cache and Cookie stores are completely incompatible with the IMS implementations. If you drop them into a fresh Laravel install and try to use them, it'll 500.


If a lineitem with the same `tag` exists, that lineitem will be used, otherwise a new lineitem will be created.

## Laravel Implementation Guide
Copy link

@Watercycle Watercycle Jan 7, 2021

Choose a reason for hiding this comment

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

Do we have any idea how other folks have used this package? Is it solely with Laravel or are there more general use cases? This README starts off hitting you with a lot of technical details. Which may make sense, but it's still pretty intimidating for someone with minimal LTI 1.3 experience.

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 know there's at least one person using this branch, but have no idea who else might user it or how.

Any recommendations for how to make the readme more accessible to new users?

Copy link

@Watercycle Watercycle Jan 7, 2021

Choose a reason for hiding this comment

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

Mhmm, I don't have any practical suggestions.

It largely depends on target audience and how much effort we want to put into it. What comes to mind is either walking through integrating this with a fresh Laravel app or linking to another open-source repo demoing the already setup library. At least for me, it's hard to see how all of these pieces are tied together at first when all the technical details are laid out without runnable examples. Though, the newly added tests do help out here.

I say Laravel because most PHP folks are familiar with Laravel. It's easy to engineer things once you understand how they work. Starting with all the implementation details being generic is tricky to follow at first.

README.md Outdated
@@ -1,181 +1,196 @@
# LTI 1.3 Advantage Library

Choose a reason for hiding this comment

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

This is nit-picking, but I don't see "Advantage" mentioned anywhere else in the project. Seems kind of random for the main page title.

Copy link
Member Author

Choose a reason for hiding this comment

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

LTI 1.3's full name is "LTI v1.3 and LTI Advantage" ... I'm not exactly sure what the terms mean, tbh. I think the "Advantage" part may refer to things like roster pull and gradebook sync, whereas the "1.3" part maybe refers to the actual launch process?

@@ -1,181 +1,196 @@
# LTI 1.3 Advantage Library

Copy link

@Watercycle Watercycle Jan 7, 2021

Choose a reason for hiding this comment

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

Briefly skimming through the README, I'm not sure I understand what all this library offers to help get an app LTI 1.3 compatible. It's okay if the answer is no, but is there anything that can add to the overview to make the benefits of this package clearer at first glance?

Copy link

@EricTendian EricTendian left a comment

Choose a reason for hiding this comment

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

Nice work. Besides the comments below, I noticed some other places where we were still using old constant names - run this package thru a linter and you'll be able to find more of them. (I just used PhpStorm)

Copy link

@EricTendian EricTendian left a comment

Choose a reason for hiding this comment

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

Noticed a few more issues and two things not addressed yet. (used PhpStorm for linting)

}

public function cacheLaunchData($key, $jwt_body)
public function cacheLaunchData($key, $jwtbody)

Choose a reason for hiding this comment

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

This case doesn't match the case in the interface.

throw new LtiException('Missing Nonce');
}
if (!$this->cache->checkNonce($this->jwt['body']['nonce'])) {
//throw new LtiException("Invalid Nonce");

Choose a reason for hiding this comment

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

Should this be commented out?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's commented out in the current branch that we're using. I checked the blame, and it's been commented out for as long as we've been using it. I'm not sure, but can look into it. Probably shouldn't be commented out, but who knows.

Choose a reason for hiding this comment

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

Ah, that's fine then - just looked weird.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, not sure why it was commented out, but added it back in successfully.

@EricTendian EricTendian self-assigned this Jan 11, 2021
@dbhynds
Copy link
Member Author

dbhynds commented Jan 12, 2021

Now that we're actually validating the Nonce, it's causing our LTI 1.3 cert suite to fail. Looking into why exactly.

@dbhynds
Copy link
Member Author

dbhynds commented Jan 12, 2021

Alright, everything passes. I also tested manual launching with LTI 1.3

@dbhynds dbhynds requested a review from EricTendian January 12, 2021 16:51
Copy link

@EricTendian EricTendian left a comment

Choose a reason for hiding this comment

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

Looks good, I just see one comment that still isn't addressed. https://github.com/packbackbooks/lti-1-3-php-library/pull/1/files#r555240560

@dbhynds dbhynds requested a review from EricTendian January 13, 2021 16:36
Copy link

@EricTendian EricTendian left a comment

Choose a reason for hiding this comment

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

Awesome work!

@dbhynds dbhynds merged commit 879addb into master Jan 13, 2021
@dbhynds dbhynds deleted the updates branch January 13, 2021 16:50
pbcraig pushed a commit that referenced this pull request May 25, 2021
First commit of a pr workflow github action
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.

4 participants