Problem/Motivation

Support for an EncryptionKey was added in in New property on AuthorizationServer to receive an encryption key which is used for future encryption/decryption instead of keybased encryption/decryption.

As of Trigger an E_USER_DEPRECATED notice instead of an error a notice will be trggered every time a key is requested.

Proposed resolution

Use the AuthorizationServer::setEncryptionKey() method when an AuthorizationServer is instantiated. The only place I found that creates an AuthorizationServer is Oauth2GrantManager. Add the setEncryptionKey method to AuthorizationServer instances.

Remaining tasks

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joum created an issue. See original summary.

joum’s picture

The token attribution works correctly, but when the token is used to GET a resource, a 401 is returned with the message:

{
"message": "No authentication credentials provided."
}

Drupal's watchdog reports the following:

User deprecated function: You must set the encryption key going forward to improve the security of this library - see this page for more information https://oauth2.thephpleague.com/v5-security-improvements/

joum’s picture

joum’s picture

Well, the patch didn't do anything. -_-'

The watchdog reports the following:

Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException: No authentication credentials provided. in Drupal\basic_auth\Authentication\Provider\BasicAuth->challengeException() (line 133 of /vagrant/www/core/modules/basic_auth/src/Authentication/Provider/BasicAuth.php).

joum’s picture

Here's a patch to force the 5.1.3 version of the League package until this is properly fixed (not sure if it will work).

joum’s picture

The latest patch was absolute idiocy on my behalf. Composer installs the wrong dependency before applying the patch.

Running out of ideas here, any help would be very welcome.

balsama’s picture

Status: Active » Needs review
Issue tags: +Needs tests
FileSize
872 bytes

That seems like the right approach to me and actually fixes the issue for us. I cleaned up the patch a bit and used Random::string to generate the key. We have a test for this in our project, but this should probably have a test here too.

balsama’s picture

Title: Breaking change in League package » thephpleague/oauth2-server now requires an EncryptionKey to be set on all instances of AuthorizationServer
Issue summary: View changes
FileSize
1.07 KB

Sorry, was thinking that Random::string was static. Fixed and added a comment. Also updated IS.

balsama’s picture

Priority: Critical » Normal
Issue summary: View changes

Setting priority as I'm pretty sure this isn't critical.

Also noticed that joum had already linked to some documentation that implies a random string is expected and suitable, which I had raised as a question in the IS (thanks! https://oauth2.thephpleague.com/v5-security-improvements/)

balsama’s picture

Issue summary: View changes

Status: Needs review » Needs work

The last submitted patch, 8: 2901180-8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

e0ipso’s picture

Status: Needs work » Fixed

This will be addressed in https://www.drupal.org/node/2883862#comment-12226499. Sorry for mixing stuff but I worked on it on a plane and didn't have the numbers.

Status: Fixed » Closed (fixed)

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