-
Notifications
You must be signed in to change notification settings - Fork 950
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
Implemented JWT Authorization Grant for #20. #24
Conversation
Added composer files to .gitignore.
…nce to decide whether we should check for user credentials.
"autoload": { | ||
"psr-0": { "OAuth2": "src/" } | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace issue?
Looks like there are no real changes to this file at all.
This looks awesome! Thank you so much for writing all this and submitting it! Before I merge it, we just need to do two things:
|
…n validateClientCredentials() as defined in ClientAssertionTypeInterface.
Updated :) Hopefully everything's fine now :) |
I'm sorry. This PR now touches every file in the repository, and has added tons of changes to files it does not need to edit. I cannot except this. This PR has become too messy for me to understand the changes being requested. I am going to close it, but please submit another one once it's cleaned up. Also, the method in the new Interface should be |
I think |
Hmm... I cannot find anywhere in the fig standards where there must be an empty line before a |
I tried a revert and things started breaking :( What I have done:
What I will then do is run The only flaw is that if you run |
I see, you ran it with the
|
I just tried with There also seems to be an issue with one of the class files:
Should I instead do a pull request that consists of the commits for JWT and a commit for the fixed files? |
This travis-ci build also seems to be stuck: https://travis-ci.org/bshaffer/oauth2-server-php/builds/4175697 |
I'm just getting started but my first attempt to instantiate \OAuth\Server leads me to what appears to be a very similar message:
Where the error originates is simply my storage object which is heavily modelled after the base Mongo storage adapter. The class starts like this:
Because I'm operating in my own namespace I used the explicit Ken p.s. obviously I'd expect if this did work that I'd need to make the same "use" statements for the other interfaces referred to but I haven't bothered to tackle that one yet. |
@ksnyde This looks like the class could not be found. Make sure you include the autoloader to load the classes from the library. See https://github.com/bshaffer/oauth2-server-php#installation Alternatively, the library is PSR-0 compliant, so if you have a PSR-0 autoloader you can use that. Or, if you are using composer, composer should generate a valid autoloader, so you can use that too. |
Yes I have included the autoloader. Here's my code:
For what it's worth this is my index.php in Restler (aka, the first file loaded for any API request). It then handes off execution to a handler class which then instantiates my storage class. |
The use statements do not require a prefixing backslash (ie \OAuth2...). This seems benign to me, but it may be confusing the autoloader. On Tue, Jul 2, 2013 at 4:17 AM, Francis Chuang [email protected]
|
Actually they DO require a backslash when the object is in a namespace other than root. In any event I tried both but as you probably already know if I have this code:
it will look for MonkeyDo in the |
No, this is incorrect. The prefixing slash is only necessary when a class is referenced outside the namespace LG\OAuth;
use LG\Connection as Connection;
use \OAuth2\ResponseType\AuthorizationCodeInterface as AuthorizationCodeInterface; As the Autoloader looks for the prefix "OAuth2", it is possible this is causing the error. I suggest trying this instead: namespace LG\OAuth;
use LG\Connection as Connection;
use OAuth2\ResponseType\AuthorizationCodeInterface as AuthorizationCodeInterface; It's just a guess... I cannot fathom what else might cause this. |
Well just for shits and giggles I thought I better try it again without the leading backslash. Same result but I was surprised to see the resolution to the appropriate namespace did work without the backslash ... I know I've seen the opposite behaviour and therefore including the backslash seems more defensive to me. Maybe the variation in behaviour comes from details in the PSR0 spec? I've been meaning to make sure that I am 100% compliant with ... I'm know I'm close. In any event. I am quite certain this is not related to the issue as I've now just run from the interactive PHP environment three commands:
and I get the following:
|
BTW, my CouchbaseStorage file now looks like this:
|
Furthermore, I have checked and abstract references to Same applies to the other three cases. In this first case, the implementation is probably just returning a boolean value ... effectively its configuration. I'll see if the other missing methods are this straight forward. Might be good to have the examples have a default value for these parameters if that's the case? Would allow them to work out-of-the-box. |
Change your class header to this: namespace LG\Oauth;
use LG\Connection as Connection;
use OAuth2\Storage\AuthorizationCodeInterface as AuthorizationCodeInterface;
use OAuth2\Storage\AccessTokenInterface as AccessTokenInterface;
use OAuth2\Storage\UserCredentialsInterface as UserCredentialsInterface;
use OAuth2\Storage\ClientCredentialsInterface as ClientCredentialsInterface;
use OAuth2\Storage\RefreshTokenInterface as RefreshTokenInterface;
use OAuth2\Storage\JwtBearerInterface as JwtBearerInterface; As mentioned in your other ticket, you do not want to use the |
Wow. That works. I'm at a loss. Where do I find the implementation of methods like Ok, I see the failure in my logic. I had added the \ResponseType references earlier because I had been trying to trace the classname backwards and didn't realise there were two classes of the same name. Thanks for you patience/help. |
No problem! Glad we could get it sorted out. Yes, |
This is an implementation of the JWT Authorization Grant.
Tests included and passing :)