Skip to content

Commit d26e581

Browse files
authored
Merge pull request #159 from auth0/merge-changes-from-master
Merge changes from master
2 parents 5b2a011 + e23b707 commit d26e581

File tree

13 files changed

+274
-25
lines changed

13 files changed

+274
-25
lines changed

.circleci/config.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,18 @@ commands:
2020
paths:
2121
- vendor
2222

23-
jobs:
24-
php_7:
25-
docker:
23+
jobs:
24+
php_7:
25+
docker:
2626
- image: circleci/php:7.1
2727
steps:
2828
- prepare
29+
- run:
30+
name: Check PHP Compatibility
31+
command: composer phpcs
32+
- run:
33+
name: Run Tests
34+
command: composer test
2935
snyk:
3036
docker:
3137
- image: snyk/snyk-cli:composer
@@ -48,6 +54,6 @@ workflows:
4854
- php_7
4955
- snyk:
5056
# Must define SNYK_TOKEN env
51-
context: snyk-env
52-
requires:
53-
- php_7
57+
context: snyk-env
58+
requires:
59+
- php_7

.github/stale.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Configuration for probot-stale - https://github.com/probot/stale
2+
3+
# Number of days of inactivity before an Issue or Pull Request becomes stale
4+
daysUntilStale: 90
5+
6+
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
7+
daysUntilClose: 7
8+
9+
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
10+
exemptLabels: []
11+
12+
# Set to true to ignore issues with an assignee (defaults to false)
13+
exemptAssignees: true
14+
15+
# Label to use when marking as stale
16+
staleLabel: closed:stale
17+
18+
# Comment to post when marking as stale. Set to `false` to disable
19+
markComment: >
20+
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
build/
12
vendor/
23
.env
34
.DS_Store
45
composer.lock
5-
composer.phar
6+
composer.phar
7+
.phpunit.result.cache

.phpcs.xml.dist

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="Laravel-Auth0" namespace="Auth0PHP\CS\Standard">
3+
<description>A custom coding standard for the Laravel Auth0 package</description>
4+
5+
<file>./src</file>
6+
7+
<!-- Only check PHP files. -->
8+
<arg name="extensions" value="php"/>
9+
10+
<!-- Show progress, show the error codes for each message (source). -->
11+
<arg value="sp"/>
12+
13+
<!-- Strip the filepaths down to the relevant bit. -->
14+
<arg name="basepath" value="."/>
15+
16+
<!-- Show coloured output, if available. -->
17+
<arg name="colors"/>
18+
19+
<!--
20+
PHPCompatibility sniffs to check for PHP cross-version incompatible code.
21+
https://github.com/PHPCompatibility/PHPCompatibility
22+
-->
23+
<config name="testVersion" value="5.5-"/>
24+
<rule ref="PHPCompatibility"/>
25+
26+
</ruleset>

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Change Log
22

3+
## [5.3.1](https://github.com/auth0/laravel-auth0/tree/5.3.1) (2019-11-14)
4+
[Full Changelog](https://github.com/auth0/laravel-auth0/compare/5.3.0...5.3.1)
5+
6+
**Closed issues**
7+
- Setting of state_handler in Auth0Service causes "Invalid state" error [\#154](https://github.com/auth0/laravel-auth0/issues/154)
8+
9+
**Fixed**
10+
- Allow store and state_handler to be passed in from config [\#156](https://github.com/auth0/laravel-auth0/pull/156) ([joshcanhelp](https://github.com/joshcanhelp))
11+
- Add 'persist_refresh_token' key to laravel-auth0 configuration file. [\#152](https://github.com/auth0/laravel-auth0/pull/152) ([tpenaranda](https://github.com/tpenaranda))
12+
- Replace `setEnvironment` with `setEnvProperty` [\#145](https://github.com/auth0/laravel-auth0/pull/145) ([nstapelbroek](https://github.com/nstapelbroek))
13+
314
## [5.3.0](https://github.com/auth0/laravel-auth0/tree/5.3.0) (2019-09-26)
415
[Full Changelog](https://github.com/auth0/laravel-auth0/compare/5.2.0...5.3.0)
516

composer.json

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@
33
"description": "Laravel plugin that helps authenticate with the auth0 service",
44
"license": "MIT",
55
"require": {
6-
"php": ">=5.4.0",
6+
"php": ">=5.5.0",
77
"illuminate/support": "5.* | ^6.0",
88
"auth0/auth0-php": "^5.6.0",
99
"illuminate/contracts": "5.* | ^6.0"
1010
},
11+
"require-dev": {
12+
"phpunit/phpunit": "^4 | ^7",
13+
"squizlabs/php_codesniffer": "^3.2",
14+
"phpcompatibility/php-compatibility": "^8.1",
15+
"dealerdirect/phpcodesniffer-composer-installer": "^0.5.0",
16+
"orchestra/testbench": "^3.8"
17+
},
18+
"scripts": {
19+
"test": "SHELL_INTERACTIVE=1 \"vendor/bin/phpunit\" --coverage-text ",
20+
"phpcs": "\"vendor/bin/phpcs\"",
21+
"sniffs": "\"vendor/bin/phpcs\" -e"
22+
},
1123
"autoload": {
1224
"classmap": [
1325
"src/controllers",
@@ -17,6 +29,11 @@
1729
"Auth0\\Login\\": "src/"
1830
}
1931
},
32+
"autoload-dev": {
33+
"psr-4": {
34+
"Auth0\\Login\\Tests\\": "tests"
35+
}
36+
},
2037
"extra": {
2138
"laravel": {
2239
"providers": [

examples/README.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

phpunit.xml.dist

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit bootstrap="vendor/autoload.php"
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
verbose="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false">
12+
<testsuites>
13+
<testsuite name="Auth0 Laravel Test Suite">
14+
<directory>tests</directory>
15+
</testsuite>
16+
</testsuites>
17+
<filter>
18+
<whitelist>
19+
<directory suffix=".php">src/</directory>
20+
</whitelist>
21+
</filter>
22+
</phpunit>

src/Auth0/Login/Auth0Service.php

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace Auth0\Login;
44

5+
use Auth0\SDK\API\Helpers\State\SessionStateHandler;
56
use Auth0\SDK\API\Helpers\State\StateHandler;
67
use Auth0\SDK\Auth0;
78
use Auth0\SDK\Helpers\Cache\CacheHandler;
89
use Auth0\SDK\JWTVerifier;
910
use Auth0\SDK\Store\StoreInterface;
10-
use Config;
1111
use Illuminate\Contracts\Container\BindingResolutionException;
1212
use Illuminate\Http\RedirectResponse;
1313

@@ -29,18 +29,26 @@ class Auth0Service
2929
* Auth0Service constructor.
3030
*
3131
* @param array $auth0Config
32-
* @param StoreInterface $sessionStorage
32+
* @param StoreInterface|null $store
3333
* @param StateHandler|null $stateHandler
34-
*
35-
* @throws \Auth0\SDK\Exception\CoreException
3634
*/
3735
public function __construct(
3836
array $auth0Config,
39-
StoreInterface $sessionStorage,
40-
StateHandler $stateHandler
37+
StoreInterface $store = null,
38+
StateHandler $stateHandler = null
4139
)
4240
{
43-
$auth0Config['store'] = $sessionStorage;
41+
$store = isset( $auth0Config['store'] ) ? $auth0Config['store'] : $store;
42+
if (false !== $store && !$store instanceof StoreInterface) {
43+
$store = new LaravelSessionStore();
44+
}
45+
46+
$stateHandler = isset( $auth0Config['state_handler'] ) ? $auth0Config['state_handler'] : $stateHandler;
47+
if (false !== $stateHandler && !$stateHandler instanceof StateHandler) {
48+
$stateHandler = new SessionStateHandler($store);
49+
}
50+
51+
$auth0Config['store'] = $store;
4452
$auth0Config['state_handler'] = $stateHandler;
4553
$this->auth0 = new Auth0($auth0Config);
4654
}

src/Auth0/Login/LoginServiceProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44

55
use Auth0\SDK\API\Helpers\ApiClient;
66
use Auth0\SDK\API\Helpers\InformationHeaders;
7-
use Auth0\SDK\API\Helpers\State\SessionStateHandler;
87
use Auth0\SDK\API\Helpers\State\StateHandler;
8+
use Auth0\SDK\API\Helpers\State\SessionStateHandler;
99
use Auth0\SDK\Store\StoreInterface;
1010
use Illuminate\Support\ServiceProvider;
1111

1212
class LoginServiceProvider extends ServiceProvider
1313
{
1414

15-
const SDK_VERSION = "5.3.0";
15+
const SDK_VERSION = "7.0.0";
1616

1717
/**
1818
* Bootstrap the application events.
@@ -59,7 +59,7 @@ public function register()
5959
return new Auth0Service(
6060
$app->make('config')->get('laravel-auth0'),
6161
$app->make(StoreInterface::class),
62-
$app->make(SessionStateHandler::class)
62+
$app->make(StateHandler::class)
6363
);
6464
});
6565
$this->app->singleton('auth0', function () {

0 commit comments

Comments
 (0)