-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[Slim] Add ApiKey and OAuth authentication middleware #1207
[Slim] Add ApiKey and OAuth authentication middleware #1207
Conversation
#1092 related issue |
Major question to PHP committee, can I drop |
Sure but let's target 4.0.x branch, which will be released in Dec. |
That sounds good to me. 👍 |
ddeccdb
to
5da2d83
Compare
5da2d83
to
e570200
Compare
This commit will be dropped, when official repo approves submitted PRs. Right now it's for test purposes only.
Considered to use dyorg/slim-token-authentication for all authentication schemes. User needs to decode and parse Basic token himself, but it's pretty simple task and there are many code examples in the web. Most of time solution is two lines of code.
I've changed PHP version to 7 and updated comments to follow main recommendations. Used PHPCodesniffer rules are Generic.Commenting, Squiz.Commenting, PEAR.Commenting. Of course I applied only reasonable sniffs from this standards. @category tag has been deleted as deprecated accordingly to phpDocumentor offical docs. Ref: http://docs.phpdoc.org/references/phpdoc/tags/category.html
e570200
to
58b7bd8
Compare
Ref to related PR in Slim Token Authentication repo: |
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.
This commit will be dropped, when official repo approves submitted PRs.
Right now it's for test purposes only.
Thanks for the details. Looks good to me. 👍
) * [Slim] Add fork of token middleware This commit will be dropped, when official repo approves submitted PRs. Right now it's for test purposes only. * [Slim] Adds token middleware to template * [Slim] Move auth implementation to external classes * [Slim] Update readme * [Slim] Add config example * [Slim] Remove deprecated package Considered to use dyorg/slim-token-authentication for all authentication schemes. User needs to decode and parse Basic token himself, but it's pretty simple task and there are many code examples in the web. Most of time solution is two lines of code. * [Slim] Format phpdoc comments I've changed PHP version to 7 and updated comments to follow main recommendations. Used PHPCodesniffer rules are Generic.Commenting, Squiz.Commenting, PEAR.Commenting. Of course I applied only reasonable sniffs from this standards. @category tag has been deleted as deprecated accordingly to phpDocumentor offical docs. Ref: http://docs.phpdoc.org/references/phpdoc/tags/category.html * [Slim] Refresh samples
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{LANG}-petstore.sh
if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\
.master
,3.4.x
,4.0.x
. Default:master
.Description of the PR
First of all, that feature is authentication only. It contains token/apiKey parsing and it validation. It doesn't contain token signing and all tasks related to authorization yet.
I've checked all secured endpoints with fake petstore spec. It turns out that some server ignores http headers with underscores, so header
api_key
doesn't work, whileapi-key
/apikey
works.There are official list of Slim middlewares
Slim OAuth middleware looks like overkill to me, so I've ended up with my fork of Slim token authentication.
✔️ Maybe we should deprecate Slim Basic Authentication package and do all the job with Slim token authentication, to make implementation more consistent and reduce dependency list.
✔️ I've decided to move so called
authenticators
into external PHP classes. Three classesBasicAuthenticator
,ApiKeyAuthenticator
andOAuthAuthenticator
should extendAbstractAuthenticator
. Don't know if it's breaking changes or not. Probably breaking changes with fallback.cc @jebentier @dkarlovi @mandrean @jfastnacht @ackintosh