Comments

alan_blake created an issue. See original summary.

alan_blake’s picture

Status: Active » Needs review
StatusFileSize
new369 bytes
e0ipso’s picture

Thanks for the patch!

Tests are failing for the new version of the dependency, retesting just in case.


@alan_blake what is new in the new version of the library?

e0ipso’s picture

Hmm it seems that tests are consistently failing.

alan_blake’s picture

@e0ipso according to your comment https://www.drupal.org/project/simple_oauth/issues/2915576#comment-12487230 , the PR is merge to master branch on 12 Feb 2018, and the latest 6.x library commit is 24 Dec 2017 (https://github.com/thephpleague/oauth2-server/commits/6.1.1) , so @sime 's fix will not effect if we still using 6.x version.

test bot is so wired to delete consumer module. Test report says that "Unable to install modules: module 'simple_oauth' is missing its dependency module consumers." and I found the test bot install module from composer prefer dist, so will still install 6.X version library.

e0ipso’s picture

We still want this. Bubbling it up.

bradjones1’s picture

Title: Update dependency's version » Update league/oauth2-server to 7.1.x
StatusFileSize
new1.62 KB

A method signature also needed updating to make this work. Otherwise, pretty straightforward.

e0ipso’s picture

Status: Needs review » Needs work

Thanks for the patch!! You are awesome.

@bradjones1 it seems that tests are not passing. Maybe there something broken with our integration upon updating to the new version?

gdev2018’s picture

We still want this in the release, pls

bradjones1’s picture

Indeed...

Drupal\Tests\simple_oauth_extras\Functional\AuthCodeFunctionalTest::testAuthCodeGrant
Failed asserting that 400 matches expected 200.

et. al.

Not sure if the test needs updating or if this breaks something more globally.

bradjones1’s picture

StatusFileSize
new18.08 KB

So this took quite a bit of digging and local debugging, but I believe the test failures were the proximate result of a missing redirect_uri parameter in the auth code flow. Why this hadn't been an issue before is beyond what I explored, but I did find this note in the upstream queue relating to whether the parameter is optional (as set out in the spec) in this implementation. It's a bit old but from a read of the code in 7.1.x and this note, it appears the maintainer made the conscious choice to require it, despite the flexibility in the spec.

I also ran into an issue where some requests to the test site in functional tests were made without the cookie indicating the simpletest db to use; it would then result in errors where the site was not able to properly load the previously-created client consumer record. I replaced the request method in RequestHelperTrait with a post method that adds the appropriate cookie data.

I am admittedly not very good at writing tests so hopefully this moves us in the right direction. On the bright side I don't think there's anything particular in the newer version beyond a function signature that needed changing. So this is mostly a test fix.

bradjones1’s picture

Status: Needs work » Needs review
bradjones1’s picture

Missed a few calls but that's progress.

bradjones1’s picture

Status: Needs review » Needs work
bradjones1’s picture

Status: Needs work » Needs review
StatusFileSize
new24.23 KB

Addressing testbot failures.

bradjones1’s picture

StatusFileSize
new24.7 KB
e0ipso’s picture

+++ b/simple_oauth_extras/tests/src/Functional/AuthCodeFunctionalTest.php
@@ -272,10 +272,9 @@ class AuthCodeFunctionalTest extends TokenBearerFunctionalTestBase {
-    return $this->request('POST', $this->url, [
-      'form_params' => $valid_payload,
-    ]);
+    return $this->post($this->url, $valid_payload);

Why these changes?

e0ipso’s picture

I removed what I suspect that are unnecessary changes.

e0ipso’s picture

This should've also been reverted.

bradjones1’s picture

@e0ipso - I appreciate the review... the changes you reverted as unnecessary were required to be able to run these tests locally, specifically the post method which adds in the test UA cookie for simpletest. I wasn't able to get these to run locally without them.

I understand if you'd like to limit the scope of the patch but I did have to invest a lot of time into tracking down this particular issue on local testing, and I'm concerned other developers might have similar trouble working on this in the future? Up to you of course as maintainer. Turns out the key was the redirect_url item.

  • e0ipso committed 43377ca on 8.x-3.x authored by bradjones1
    Issue #2977127 by bradjones1, e0ipso, alan_blake, gdev2018: Update...
e0ipso’s picture

Status: Needs review » Fixed

Good point. I'm not convinced about the encryption keys, but that can be dealt with later.

Merging #16, thanks for your contribution!!!

bradjones1’s picture

Thank you. I moved the encryption keys because in my case, I was testing with a pair of docker containers and the "from" file location on one machine may not be the same as the other, so I tried to simplify this code by storing the data in the class. Agreed it's probably not mandatory but it helped to simplify things when I was debugging simpletest.

Cheers!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.