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

Alternative implementation of JWT lib #569

Merged
merged 1 commit into from
Apr 23, 2015

Conversation

phindmarsh
Copy link
Contributor

An alternate patch to PR #567 that maintains backwards compatibility with existing interfaces, but is unsafe for users who call JWT::decode themselves without passing the allowed arguments array.

The allowed algorithms for the JWTBearer grant type are specified as an additional argument to the constructor, with defaults set if the argument is null.

Addresses #564.

*/
public function __construct(JwtBearerInterface $storage, $audience, EncryptionInterface $jwtUtil = null)
public function __construct(JwtBearerInterface $storage, $audience, EncryptionInterface $jwtUtil = null, $allowedAlgorithms = null)
Copy link
Owner

Choose a reason for hiding this comment

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

This is great!! I think the only thing I would change is make the constructor the following for consistency:

public function __construct(JwtBearerInterface $storage, $audience, EncryptionInterface $jwtUtil = null, $config = array())
{
    // ...
    $this->config = array_merge(array(
        'allowed_algorithms' => array('RS256', 'RS384', 'RS512')
    ));
    // ...
}

This just keeps it consistent with the rest of the library

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yep, nice catch. Have submitted an updated commit now.

An alternate patch that maintains backwards compatibility with existing interfaces, but is unsafe for users who call JWT::decode themselves without passing the allowed arguments array.
@phindmarsh
Copy link
Contributor Author

I've updated the constructor, so this should be all good to go now 👍

@bshaffer
Copy link
Owner

woohoo! Looks great!

bshaffer added a commit that referenced this pull request Apr 23, 2015
Alternative implementation of JWT lib
@bshaffer bshaffer merged commit 34921d7 into bshaffer:develop Apr 23, 2015
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.

2 participants