-
Notifications
You must be signed in to change notification settings - Fork 212
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
Improve transient authorization data handling #397
Conversation
cca5abd
to
c1e48e9
Compare
153cd89
to
d625e12
Compare
src/Auth0.php
Outdated
$this->store = $config['store'] ?? null; | ||
if ($this->store === false) { | ||
$this->store = new EmptyStore(); | ||
} else if (! $this->store instanceof StoreInterface) { | ||
$this->store = new SessionStore(); |
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.
Refactor only, no expected functional changes.
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.
If $config['store']
is null
, is the intention for it to fall into the condition on line 300? I'm assuming that the check on 298 would return false
in this case. If so, the code isn't very clear here. At first glance I thought that the check on 298 is wrong and it should be $this->store === null
, but after looking deeper I just have more questions.
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.
Thanks for this. I'll take a step back and look at it again. It's more clear than it was before at least 😆
$transientStore = $config['transient_store'] ?? null; | ||
if (! $transientStore instanceof StoreInterface) { | ||
$transientStore = new CookieStore(); |
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.
Name changed from #395
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.
Just curious - why are we falling back to an EmptyStore
above, but not for this transient store?
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.
store
is for identity artifacts (user identity, tokens) and transientStore
is for required auth transients like nonce and state. Things work fine but are not stored if store
is empty but things break if transientStore
is.
That said, I'll take another look here along with the above.
5b36835
to
eea23f2
Compare
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Changes
Potential breaking changes:
session_base_name
config option for theAuth0
class. Instead, pass theStoreInterface
implementing class with the modified name.state_handler
config key,StateHandler
interface, andSessionStateHandler
andDummyStateHandler
classes. This makes state handling mandatory for callback routes usingAuth0::getUser()
orAuth0::exchange()
. Guidance for IpD-initiated flows will be provided in an upcoming migration guide.EmptyStore
class and the ability to passfalse
on thestore
config key. Setpersist_user
tofalse
in the config key to skip all persistence.auth0__nonce
andauth0__state
by default) on certain managed hosts.auth0__webauth_state
toauth0__state
.\Auth0\SDK\Auth0::$URL_MAP
Testing
Checklist
7.0.0-dev