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

Issu #780

Open
wants to merge 62 commits into
base: master
Choose a base branch
from
Open

Issu #780

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
565ce5b
new gitignore
lucadegasperi Nov 16, 2015
5448444
Merge branch 'master' of github.com:lucadegasperi/oauth2-server-laravel
lucadegasperi Jan 7, 2016
6c9a908
First commit for v6
lucadegasperi Jan 7, 2016
f4b82aa
folders for v6
lucadegasperi Jan 7, 2016
a5a1bd1
composer
lucadegasperi Mar 30, 2016
88954d3
Initial work on V6
lucadegasperi Mar 31, 2016
532bd83
Migrations
lucadegasperi Apr 2, 2016
a2296b1
Improvements
lucadegasperi Apr 11, 2016
b5ac4e0
Publishing
lucadegasperi Apr 11, 2016
34a3fee
Fix
lucadegasperi Apr 11, 2016
7a4114d
Certificate Keys
lucadegasperi Apr 11, 2016
7c40000
psr to httpfoundation
lucadegasperi Apr 11, 2016
45babd9
fix
lucadegasperi Apr 11, 2016
6fc5224
Fixing
lucadegasperi Apr 11, 2016
dbb8921
missing return
lucadegasperi Apr 11, 2016
c711ddc
Fix method
lucadegasperi Apr 11, 2016
07c077b
Fix
lucadegasperi Apr 11, 2016
0286f19
Begin manual testing
lucadegasperi Jun 29, 2016
f6c00e8
Adhere to interface
lucadegasperi Jun 29, 2016
0438163
Temporary workaround for user retrival
lucadegasperi Jun 29, 2016
8285b4e
Attempt at fixing things
lucadegasperi Jun 29, 2016
92351ff
another fix
lucadegasperi Jun 29, 2016
a11ae6e
moving controller logic to a trait to ease user's work
lucadegasperi Jun 29, 2016
cf5488a
Loading a default view for ease of use
lucadegasperi Jun 29, 2016
17f1c2b
wrong syntax
lucadegasperi Jun 29, 2016
868b323
Some files
lucadegasperi Jun 29, 2016
487056c
boolean casting
lucadegasperi Jun 29, 2016
59283e6
relationship save fix
lucadegasperi Jun 29, 2016
01d1cfc
redirect uris can be null when default one for client is used
lucadegasperi Jun 29, 2016
514dfa7
renaming and fixes
lucadegasperi Jun 29, 2016
5ca77ed
Improved guard
lucadegasperi Jun 30, 2016
76eb55e
Use illuminate request and do conversion inside
lucadegasperi Jun 30, 2016
b19bb3f
added access token parameter
lucadegasperi Jun 30, 2016
76cb94e
casting client to entity
lucadegasperi Jun 30, 2016
69924e7
Fix constructor
lucadegasperi Jun 30, 2016
1163b03
added use statement
lucadegasperi Jun 30, 2016
a34dd1d
workaround
lucadegasperi Jun 30, 2016
6031edf
second fix
lucadegasperi Jun 30, 2016
1336dbc
Working on scopes
lucadegasperi Jul 5, 2016
25f5926
Run coding standards fixer script
vinkla Jul 5, 2016
f80d19e
Add service provider test
vinkla Jul 5, 2016
2bdadf3
Update php support
vinkla Jul 5, 2016
0b7cc3d
Add laravel 5.3 support
vinkla Jul 5, 2016
82db7db
Update dependencies
vinkla Jul 7, 2016
6f8c31b
Remove 5.5 from travis tests
vinkla Jul 7, 2016
d87965f
Remove phpspsec
vinkla Jul 7, 2016
73540ef
Working on changelog
vinkla Jul 7, 2016
53f51f3
Update config and migrations methods
vinkla Jul 7, 2016
ed83388
Add resources folder
vinkla Jul 7, 2016
b031372
Add php_cs file
vinkla Jul 15, 2016
5635ff3
Run coding standards script
vinkla Jul 15, 2016
03fa6e5
Update readme
vinkla Jul 15, 2016
6953944
CS fixes
vinkla Jul 15, 2016
51f89ee
CS fixes
vinkla Jul 15, 2016
cfea6f4
Add styleci badge
vinkla Jul 15, 2016
fbb4776
Reorder badges
vinkla Jul 15, 2016
aa75d46
Build status should go first
vinkla Jul 15, 2016
d6f4fd0
Order by color
vinkla Jul 15, 2016
2969c26
Add author
vinkla Jul 26, 2016
2bbf3ff
Add table docblocs
vinkla Jul 26, 2016
c1620f5
Add date docblocs
vinkla Jul 26, 2016
3ea5647
CS fix
vinkla Jul 26, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/.travis.yml export-ignore
/.scrutinizer.yml export-ignore
/phpunit.xml.dist export-ignore
/phpspec.xml.dist export-ignore
/CHANGELOG.md export-ignore
/CONTRIBUTING.md export-ignore
/README.md export-ignore
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
composer.lock
phpunit.xml
phpspec.yml
vendor
89 changes: 89 additions & 0 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?php

$header = <<<EOF
This file is part of Laravel OAuth 2.0.

(c) Luca Degasperi <[email protected]>

For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;

$fixers = [
// PSR-0
'-psr0',

// PSR-1
'encoding',
'short_tag',

// Symfony
'array_element_white_space_after_comma',
'blankline_after_open_tag',
'concat_without_spaces',
'duplicate_semicolon',
'empty_return',
'extra_empty_lines',
'function_typehint_space',
'include',
'join_function',
'list_commas',
'multiline_array_trailing_comma',
'namespace_no_leading_whitespace',
'new_with_braces',
'no_blank_lines_after_class_opening',
'no_empty_lines_after_phpdocs',
'object_operator',
'operators_spaces',
'phpdoc_indent',
'phpdoc_no_access',
'phpdoc_no_package',
'phpdoc_scalar',
'phpdoc_separation',
'phpdoc_short_description',
'phpdoc_to_comment',
'phpdoc_trim',
'phpdoc_type_to_var',
'phpdoc_var_without_name',
'print_to_echo',
'remove_leading_slash_use',
'remove_lines_between_uses',
'return',
'self_accessor',
'short_bool_cast',
'single_array_no_trailing_comma',
'single_blank_line_before_namespace',
'single_quote',
'spaces_before_semicolon',
'spaces_cast',
'standardize_not_equal',
'ternary_spaces',
'trim_array_spaces',
'unalign_double_arrow',
'unalign_equals',
'unary_operators_spaces',
'unneeded_control_parentheses',
'unused_use',
'whitespacy_lines',

// Contrib
'header_comment',
'multiline_spaces_before_semicolon',
'newline_after_open_tag',
'ordered_use',
'php_unit_construct',
'php_unit_strict',
'phpdoc_order',
'short_array_syntax',
'short_echo_tag',
];

Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header);

$finder = Symfony\CS\Finder\DefaultFinder::create()
->in(__DIR__);

return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->fixers($fixers)
->finder($finder);
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
language: php

php:
- 5.5.9
- 5.5
- 5.6
- 7.0
- hhvm

sudo: false

install:
- travis_retry composer install --no-interaction --prefer-source
- travis_retry composer install --no-interaction

script:
- if [ "$TRAVIS_PHP_VERSION" != "5.5.9" ] && [ "$TRAVIS_PHP_VERSION" != "5.5" ] && [ "$TRAVIS_PHP_VERSION" != "5.6" ]; then vendor/bin/phpunit; vendor/bin/phpspec run; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; fi
- vendor/bin/phpunit --coverage-clover build/logs/clover.xml

after_script:
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
- if [ "$TRAVIS_PHP_VERSION" == "5.5.9" ] || [ "$TRAVIS_PHP_VERSION" == "5.5" ] || [ "$TRAVIS_PHP_VERSION" == "5.6" ]; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# CHANGELOG

## 6.0.0 (upcoming)

- Rewrite for league/oauth2-server 5.0
- Added Laravel 5.3 support
- Added auth guard support
- Removed PHP 5.5 support

## 5.1.1 (released 2015-12-22)

- Fix Laravel 5.2 support bug
Expand Down
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# OAuth 2.0 Server for Laravel
# Laravel OAuth 2.0

![oauth2-server-laravel](https://cloud.githubusercontent.com/assets/499192/9065550/751404ba-3ad2-11e5-9f92-3d4d5d4b9c54.png)

[OAuth 2.0](http://tools.ietf.org/wg/oauth/draft-ietf-oauth-v2/) authorization server and resource server for the Laravel and Lumen frameworks. Standard compliant thanks to the amazing work by [The League of Extraordinary Packages](http://www.thephpleague.com) OAuth 2.0 authorization server and resource server.

[![Latest Version](http://img.shields.io/github/release/lucadegasperi/oauth2-server-laravel.svg?style=flat-square)](https://github.com/lucadegasperi/oauth2-server-laravel/releases)
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Build Status](https://img.shields.io/travis/lucadegasperi/oauth2-server-laravel/master.svg?style=flat-square)](https://travis-ci.org/lucadegasperi/oauth2-server-laravel)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/lucadegasperi/oauth2-server-laravel/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/lucadegasperi/oauth2-server-laravel/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/lucadegasperi/oauth2-server-laravel/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/lucadegasperi/oauth2-server-laravel)
[![Total Downloads](https://img.shields.io/packagist/dt/lucadegasperi/oauth2-server-laravel.svg?style=flat-square)](https://packagist.org/packages/lucadegasperi/oauth2-server-laravel)
[![Build Status](https://img.shields.io/travis/lucadegasperi/oauth2-server-laravel/master.svg?style=flat)](https://travis-ci.org/lucadegasperi/oauth2-server-laravel)
[![StyleCI](https://styleci.io/repos/13300645/shield?style=flat)](https://styleci.io/repos/13300645)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/lucadegasperi/oauth2-server-laravel/master.svg?style=flat)](https://scrutinizer-ci.com/g/lucadegasperi/oauth2-server-laravel/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/lucadegasperi/oauth2-server-laravel/master.svg?style=flat)](https://scrutinizer-ci.com/g/lucadegasperi/oauth2-server-laravel)
[![Total Downloads](https://img.shields.io/packagist/dt/lucadegasperi/oauth2-server-laravel.svg?style=flat)](https://packagist.org/packages/lucadegasperi/oauth2-server-laravel)
[![Latest Version](http://img.shields.io/github/release/lucadegasperi/oauth2-server-laravel.svg?style=flat)](https://github.com/lucadegasperi/oauth2-server-laravel/releases)
[![License](https://img.shields.io/packagist/l/lucadegasperi/oauth2-server-laravel.svg?style=flat)](https://packagist.org/packages/lucadegasperi/oauth2-server-laravel)

> **Note:** This package assumes you have a good-enough knowledge of the principles behind the [OAuth 2.0 authorization specification](http://tools.ietf.org/html/rfc6749).

Expand All @@ -23,6 +24,7 @@
5.0.x | 4.0.x |>= 5.4
5.1.x | 5.0.x |>= 5.5.9
5.2.x | 5.1.x |>= 5.5.9
5.3.x | 6.0.x |>= 5.6.4

## Documentation

Expand Down
36 changes: 16 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lucadegasperi/oauth2-server-laravel",
"description": "An OAuth 2.0 bridge for Laravel and Lumen",
"keywords": ["oauth2", "oauth", "server", "api", "laravel", "lumen"],
"description": "An OAuth 2.0 bridge for Laravel",
"keywords": ["oauth2", "oauth", "server", "api", "laravel", "league", "authentication", "authorization"],
"license": "MIT",
"authors": [
{
Expand All @@ -14,21 +14,21 @@
}
],
"require": {
"php": ">=5.5.9",
"illuminate/database": "5.1.* || 5.2.*",
"illuminate/console": "5.1.* || 5.2.*",
"illuminate/contracts": "5.1.* || 5.2.*",
"illuminate/http": "5.1.* || 5.2.*",
"illuminate/support": "5.1.* || 5.2.*",
"illuminate/config": "5.1.* || 5.2.*",
"league/oauth2-server": "4.1.*"
"php": "^5.6.4 || ^7.0",
"illuminate/config": "5.2.* || 5.3.*",
"illuminate/console": "5.2.* || 5.3.*",
"illuminate/contracts": "5.2.* || 5.3.*",
"illuminate/database": "5.2.* || 5.3.*",
"illuminate/http": "5.2.* || 5.3.*",
"illuminate/support": "5.2.* || 5.3.*",
"league/oauth2-server": "^5.0",
"symfony/psr-http-message-bridge": "^0.2",
"zendframework/zend-diactoros": "^1.3"
},
"require-dev": {
"orchestra/testbench": "3.1.* || 3.2.*",
"phpunit/phpunit": "^4.8 || ^5.0",
"phpspec/phpspec": "^2.2",
"mockery/mockery": "^0.9.4",
"henrikbjorn/phpspec-code-coverage": "^1.0"
"graham-campbell/testbench": "^3.2",
"mockery/mockery": "^0.9.5",
"phpunit/phpunit": "^5.4"
},
"autoload": {
"psr-4": {
Expand All @@ -41,15 +41,11 @@
},
"classmap": [
"database"
],
"files": [
"tests/AbstractTestCase.php",
"tests/integration/AbstractDBTestCase.php"
]
},
"extra": {
"branch-alias": {
"dev-master": "5.1-dev"
"dev-master": "6.0-dev"
}
},
"minimum-stability": "dev",
Expand Down
105 changes: 21 additions & 84 deletions config/oauth2.php
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/*
* This file is part of OAuth 2.0 Laravel.
* This file is part of Laravel OAuth 2.0.
*
* (c) Luca Degasperi <[email protected]>
*
Expand All @@ -26,127 +26,64 @@
| http://git.io/vJLAv
|
*/

'grant_types' => [

[
'class' => \League\OAuth2\Server\Grant\PasswordGrant::class,
'access_token_ttl' => '',
],
],

/*
|--------------------------------------------------------------------------
| Output Token Type
|--------------------------------------------------------------------------
|
| This will tell the authorization server the output format for the access
| token and the resource server how to parse the access token used.
|
| Default value is League\OAuth2\Server\TokenType\Bearer
|
*/

'token_type' => 'League\OAuth2\Server\TokenType\Bearer',

/*
|--------------------------------------------------------------------------
| State Parameter
|--------------------------------------------------------------------------
|
| Whether or not the state parameter is required in the query string.
|
*/

'state_param' => false,

/*
|--------------------------------------------------------------------------
| Scope Parameter
|--------------------------------------------------------------------------
|
| Whether or not the scope parameter is required in the query string.
|
*/

'scope_param' => false,

/*
|--------------------------------------------------------------------------
| Scope Delimiter
| Private Key Path
|--------------------------------------------------------------------------
|
| Which character to use to split the scope parameter in the query string.
|
*/

'scope_delimiter' => ',',
'private_key_path' => 'file://path_to_private_key/private.key',

/*
|--------------------------------------------------------------------------
| Default Scope
| Public Key Path
|--------------------------------------------------------------------------
|
| The default scope to use if not present in the query string.
|
*/

'default_scope' => null,
'public_key_path' => 'file://path_to_private_key/public.key',

/*
|--------------------------------------------------------------------------
| Access Token TTL
| Key Passphrase
|--------------------------------------------------------------------------
|
| For how long the issued access token is valid (in seconds) this can be
| also set on a per grant-type basis.
| Default value is null, put your passphrase here if the key has one
|
*/

'access_token_ttl' => 3600,
'key_passphrase' => null,

/*
|--------------------------------------------------------------------------
| Limit clients to specific grants
| Output Response Type
|--------------------------------------------------------------------------
|
| Whether or not to limit clients to specific grant types. This is useful
| to allow only trusted clients to access your API differently.
|
*/

'limit_clients_to_grants' => false,

/*
|--------------------------------------------------------------------------
| Limit clients to specific scopes
|--------------------------------------------------------------------------
| This will tell the authorization server the output format for the access
| token and the resource server how to parse the access token used.
|
| Whether or not to limit clients to specific scopes. This is useful to
| only allow specific clients to use some scopes.
| Default value is \League\OAuth2\Server\ResponseTypes\BearerTokenResponse
|
*/

'limit_clients_to_scopes' => false,
'response_type' => \League\OAuth2\Server\ResponseTypes\BearerTokenResponse::class,

/*
|--------------------------------------------------------------------------
| Limit scopes to specific grants
| Authorization Validator
|--------------------------------------------------------------------------
|
| Whether or not to limit scopes to specific grants. This is useful to
| allow certain scopes to be used only with certain grant types.
|
*/

'limit_scopes_to_grants' => false,

/*
|--------------------------------------------------------------------------
| HTTP Header Only
|--------------------------------------------------------------------------
| This will tell the resource server the validator to use to validate an incoming request
|
| This will tell the resource server where to check for the access_token.
| By default it checks both the query string and the http headers.
| Default value is \League\OAuth2\Server\AuthorizationValidators\BearerTokenValidator::class
|
*/

'http_headers_only' => false,
'authorization_validator' => \League\OAuth2\Server\AuthorizationValidators\BearerTokenValidator::class,

];
Loading