Skip to content

Commit 4246215

Browse files
committed
fixes for Lucho's review
1 parent 96bbf14 commit 4246215

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Check our docs page to get a complete guide on how to install it in an existing
2626
2727
## Security Upgrade Notes 5.1.0+
2828

29-
**State validation** is now default behaviour for improved security. By default this will automatically use **Session Storage** and will
30-
apply if you are using the combination of the `Auth0->login()` method to call the `/authorize` endpoint and using any method which calls the `Auth0->exchange()` method in your callback.
29+
**State validation** is now default behaviour for improved security. By default this will automatically use **Session Storage** and will apply if you are using the combination of the `Auth0->login()` method to call the `/authorize` endpoint and using any method which calls the `Auth0->exchange()` method in your callback.
30+
3131
If you require custom storage methods you can implement your own [StateHandler](https://github.com/auth0/auth0-PHP/blob/master/src/API/Helpers/State/StateHandler.php) and set it using the `state_handler` key when you initialize an `Auth0` instance.
3232

3333
**Important:** If you are using the `Auth0->exchange()` and using a method other than `Auth0->login()` to generate the Authorize URL you can disable the *StateHandler* by setting the `state_handler` key to `false` when you initialize the `Auth0` instance. However, it is **Highly Recommended** to implement state validation.

src/API/Helpers/State/SessionStateHandler.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Auth0\SDK\API\Helpers\State;
44

55
use Auth0\SDK\Store\SessionStore;
6-
use Auth0\SDK\Exception\CoreException;
76

87
/*
98
* This file is part of Auth0-PHP package.
@@ -54,10 +53,12 @@ public function store($state) {
5453

5554
/**
5655
* Perform validation of the returned state with the previously generated state.
57-
*
58-
* @param string $state
59-
*
60-
* @throws exception
56+
*
57+
* @param string $state
58+
*
59+
* @return bool
60+
*
61+
* @throws \Exception
6162
*/
6263
public function validate($state) {
6364
$valid = $this->store->get(self::STATE_NAME) == $state;

src/API/Helpers/State/StateHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
*
1919
* @author Auth0
2020
*/
21-
interface StateHandler {
21+
interface StateHandler
22+
{
2223

2324
/**
2425
* Generate state value to be used for the state param value during authorization.

src/Auth0.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ public function login($state = null, $connection = null, $additional_params = []
273273
}
274274

275275
$params['response_mode'] = $this->response_mode;
276-
277-
if($additional_params) {
276+
277+
if( ! empty( $additional_params ) && is_array( $additional_params ) ) {
278278
$params = array_replace($params, $additional_params);
279279
}
280280

0 commit comments

Comments
 (0)