-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor Token Manager / Auth / Token Connecting/Disconnecting #77
Refactor Token Manager / Auth / Token Connecting/Disconnecting #77
Conversation
…lugins with uplink
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.
Looks really good and thank you so much for this! Left some comments/notes
$this->notice->add( new Notice( Notice::ERROR, | ||
sprintf( | ||
__( 'The Litespeed plugin was detected, ensure "Store Transients" is set to ON and try again. See the <a href="%s" target="_blank">Litespeed documentation</a> for more information.', '%TEXTDOMAIN%' ), | ||
esc_url( 'https://docs.litespeedtech.com/lscache/lscwp/cache/#store-transients' ) | ||
), | ||
true | ||
) ); |
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.
I think we should switch to option for our nonce verification instead of transients. Have talked with @bordoni and unfortunately we are aware of customers completely disabling transients.
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.
As discussed on slack, we'll open a new PR after this one to start working on that.
|
||
if ( $result ) { | ||
// Delete the authorization cache. | ||
delete_transient( Token_Authorizer_Cache_Decorator::TRANSIENT_PREFIX . $cache_key ); |
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.
As mentioned above, i'd love to get your opinion about migrating transient usage to options instead.
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.
These new functions are great, good thinking!
Main Changes
This PR brings in some modified changes from #51, sort of a half way of that entire PR that Kadence is currently using live.
Token Manager
delete()
which still takes a slug in the event developers need to clean things up after a Resource is gone. Note, that disconnecting won't delete a resource that doesn't exist.get()
method will fall back to getting the legacy token if no specific key for a slug is found.get_all()
with a stored legacy token will include a[ 'legacy' => 'the token here' ]
entry in the array, essentiallylegacy
becomes the product slug.delete()
on any slug will always delete the legacy token if it exists.Token Connecting/Disconnecting
API
tokens/auth
endpoint now also takes a $slug when checking if a license is authorized. This is already supported by the licensing server.. See the Token_Authorizer, but, you should just use \StellarWP\Uplink\is_authorized().Authorizer
is_super_admin()
. If you actually want to see if a user has a valid remote license token, use \StellarWP\Uplink\is_authorized(). If you want to manually check if a user is authorized to perform token management, use \StellarWP\Uplink\is_user_authorized().Admin Notices
New Functions