Comments (4)
It works well enough, but I don't think overriding protected methods is good practice... If the methods change in the original lib my workaround will stop working.
This is the reason why protected methods exists - to allow overriding them.
Your approach is the recommended way and it is done like that in many places.
We also use this concept to change the behavior in many other scenarios as well.
from openid-connect-php.
Nice idea!
We are using the following for Laravel:
class OpenIDConnectClient extends BaseOpenIDConnectClient
{
protected function startSession(): void
{
// Laravel magic in the background :)
}
protected function commitSession(): void
{
Session::save();
}
/**
* @param string $key
*/
protected function getSessionKey($key): mixed
{
if (!Session::has($key)) {
return false;
}
return Session::get($key);
}
/**
* @param string $key
* @param mixed $value mixed
*/
protected function setSessionKey($key, $value): void
{
Session::put($key, $value);
}
/**
* @param string $key
*/
protected function unsetSessionKey($key): void
{
Session::remove($key);
}
/**
* Overwrite the redirect method to use Laravel's abort method.
* Sometimes the error 'Cannot modify header information - headers already sent' was thrown.
* By using Laravel's abort method, this error is prevented.
* @param string $url
* @return void
*/
public function redirect($url): void
{
App::abort(302, '', ['Location' => $url]);
}
}
from openid-connect-php.
from openid-connect-php.
This is the reason why protected methods exists - to allow overriding them.
Fair enough, I'll stick to what we have then.
Thanks !
@ricklambrechts : I'll steal some of that, it's a bit better than my version ;-)
from openid-connect-php.
Related Issues (20)
- ADFS connection configuration HOT 2
- token_endpoint_auth_methods_supported offers no choice in use HOT 6
- \Jumbojett\OpenIDConnectClient::$leeway is not overrideable
- default value for getProviderConfigValue is supposed to be string, but is array HOT 2
- Add information to README.md
- Bugs - Azure B2C - URL char issue HOT 2
- Issue when running composer require jumbojett/openid-connect-php HOT 1
- signout() does not sign me out of my application HOT 9
- requestClientCredentialsToken invalid scope in Keycloak HOT 2
- Throwed error if the server returns one is complete HOT 1
- OpenID Connect can return an id_token as part of the refresh_token grant type
- Keycloak 22.0 not supported? HOT 5
- Release new major ... HOT 1
- Cant get codeVerifier in redirectUri if we make authorization flow using PKCE HOT 1
- SERVER_PORT always causes port in redirect URL HOT 4
- Redirect doesn't remove state, session_state, and code params HOT 2
- Support dropped for phpseclib 2.*? HOT 2
- Invalid Client - Connect Token HOT 1
- Support for `id_token_signing_alg_values_supported` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openid-connect-php.