Closed tfrommen closed 7 years ago
Sorry for missing your other questions here!
Every third file looks different than the others.
Yeah: half of this code comes from the original OAuth 1 project and follows that code style, half of it is new and follows the HM coding standards (essentially, modernised WP standards).
Where to put blank lines (both in code and comments)?
Same as WP generally; generally a blank line before a comment line.
Import classes in the global namespace, yes or no?
Yes: all classes that aren't in the current namespace should be imported.
admin.php
:
Kept this around for #13, will eventually go π
inc/class-scopes.php
:
Not used yet, see #10. The code there is just the skeleton that I created in a rush to get my thoughts down.
the
OAuth2\get_grant_types()
function should both validate the data (and remove invalid handlers) and stateWP\OAuth2\Types\Type[]
instead of array as return type
Makes sense to me; will merge #14 in a moment. :)
I assume the
$args
parameter inWP\OAuth2\Tokens\Authorization_Code::validate()
is for inheritance...?
Currently unused, but we need to validate a few things to be spec compliant, notably redirect_uri
. Haven't written that code yet. :)
Sorry, too, because not all of the things in What's Left were real questions, or at least not questions to get answered (just thought about and eventually resolved).
The coding style parts were just to enumerate what I encountered (inconsistent blank lines, inconsistent namespace imports, etc.).
I just updated #14, although you still have to decide about the intended behavior when encountering an invalid type.
Just to have said that: for me, this PR is done (merged anyway, and all questions answered). Thanks. π
Hi there! π
I had some time, so I went through the current code base (i.e., the
auth-code-flow
branch, which this PR thus targets), with an army of house elves, and fixed, updated and improved a few things here and there.Sorry for not splitting up commits. I did this on purpose, though, because otherwise we would've ended up with 42 (!) commits, ... or so. I did not do any real changes to functionality, though, but see for yourself...
What Does This Pull Request Include?
WP\OAuth2\Client::check_redirect_uri()
returntrue
orfalse
.WP\OAuth2\Endpoints\Authorization::handle_request()
.int
.WP\OAuth2\Tokens\Token::is_valid()
abstract, and not static anymore.WP\OAuth2\Tokens\Token::get_meta_prefix()
method.$client
in the login template.What's Left?
admin.php
:lib/class-wp-rest-oauth1-admin.php
does not exist in this plugin.oauth1
all over.inc/class-scopes.php
:inc/endpoints/class-authorization.php
:handle_request()
method usesOAuth2\get_grant_types()
, which returns the unvalidated result of a filter,oauth2.grant_types
.OAuth2\get_grant_types()
function should both validate the data (and remove invalid handlers) and stateWP\OAuth2\Types\Type[]
instead ofarray
as return type.inc/tokens/class-authorization-code.php
:$args
parameter inWP\OAuth2\Tokens\Authorization_Code::validate()
is for inheritance...?Again, this PR targets the
auth-code-flow
branch. If you want me to make it targetmaster
instead, just tell me.Cheers, Thorsten