-
Notifications
You must be signed in to change notification settings - Fork 146
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
Extending OAuth2Client - isStateless is private #232
Comments
Yo @leevigraham! Hmm. I'm definitely not against making this protected. What's your reason for wanting to override
You, of course, can do this, but I think you are hoping to not have to reinvent-the-wheel in your custom class by reimplementing a lot of logic (which is fair). The main reason we have this
Cheers! |
Ping @leevigraham! I'm holding off on a new major release, just in case your use-case might require additional changes. Can you describe what you want to accomplish? Thanks! |
Thanks for chasing @weaverryan, I ended up implementing In my use case I need to pass extra data to the I can't quite remember what else I was trying to do (given all the other madness in the world right now). |
Cheers! Thanks for the update :) |
Yo @weaverryan ! First, thanks for your work ! Just to add some use-case to the change you'll make, I need to rewrite the In fact, my app is embedded in an iframe which call an authorization server. But it serves So I need to redirect via javascript using : <script type='text/javascript'>
window.top.location.href = '{AUTHORIZATION_URL}';
</script> Here is the redirect method I overwrited : public function redirect(array $scopes = [], array $options = [])
{
if (!empty($scopes)) {
$options['scope'] = $scopes;
}
$url = $this->getOAuth2Provider()->getAuthorizationUrl($options);
// set the state (unless we're stateless)
if (!$this->isStateless) {
$this->getSession()->set(
self::OAUTH2_SESSION_STATE_KEY,
$this->getOAuth2Provider()->getState()
);
}
$jsRedirect = "<script type='text/javascript'>
window.top.location.href = '$url';
</script>";
return new Response($jsRedirect);
} But as seen above, Also, you can consider making Thanks a lot ! |
Thanks for the extra info @benjaminmal :). It seems reasonable - check out #234. |
I was trying to extend
OAuth2Client
in my custom Client in order to override thegetAccessToken
method. However I can't access theisStateless
property becuase it'sprivate
, in fact there's a bunch ofprivate
properties and methods.How can I create a new provider and just override the one method?
From the docs:
I was also planning to override the to do something similar to #230 and override
getAccessToken
.Looking at the
OAuth2ClientInterface
should I be creating a class that implements this interface rather than extendsOAuth2Client
?Cheers
The text was updated successfully, but these errors were encountered: