-
Notifications
You must be signed in to change notification settings - Fork 102
Add a filter for nonce and state cookie names #495
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
Conversation
5dc5ef2 to
f9b14bb
Compare
lbalmaceda
left a comment
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.
what if instead of having setters for each cookie name you add a method that affects ALL the cookies' names and allows the user to set the name prefix? You'd use it like this: self::get_cookie_prefix() + static::NONCE_COOKIE_NAME
This way 1 change fixes all future errors. Unless of course, you consider the state and nonce the only ones that could fall into this issue.
lib/WP_Auth0_Nonce_Handler.php
Outdated
| if ( defined( static::NONCE_COOKIE_NAME ) && isset( $_COOKIE[ self::get_storage_cookie_name() ] ) ) { | ||
| // Have a cookie, don't want to generate a new one. | ||
| $this->unique = $_COOKIE[ static::NONCE_COOKIE_NAME ]; | ||
| $this->unique = $_COOKIE[ self::get_storage_cookie_name() ]; |
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.
what about self::get_cookie_prefix() + static::NONCE_COOKIE_NAME? Same for the remaining calls
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.
No need to exert that kind of control, name is irrelevant.
|
@lbalmaceda - I'd rather the developer have full control over the name. |
|
@lbalmaceda - Added a sample usage to prefix all cookie names. |
|
Ah it's easier than I thought. OK! |
lbalmaceda
left a comment
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.
🍇
|
Thank you, thank you, thank you. |
protectedget_storage_cookie_name()to public + staticauth0_state_cookie_nameandauth0_none_cookie_namefilter to the two affected methodsSample usage:
Passes all functional tests.
Closes #494