You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use custom authenticators (independent on Nette\Security\Authenticator interface) which produce instances of Nette\Security\IIdentity so that it can be used for User#login($identity) afterwards. Inside of the identity, there is an object which need to be (de)serialized in a special way. IdentityHandler seems perfect for this job.
Sadly, in current implementation, IdentityHandler is only applied if it's implemented within Authenticator, but not standalone. As a workaround, I can:
create fake authenticator implementing the Nette one and IdentityHandler as well (see below)
don't use User at all
Example of fake authenticator:
class Authenticator implements \Nette\Security\Authenticator
{
publicfunctionauthenticate(...)
{
thrownewException('Don\'t use me for authentication');
}
publicfunctionsleepIdentity(...) { ... } // real workpublicfunction wakeupIdentity(...) { ... } // real work
Suggestion
Support IdentityHandler on its own with a configuration param. User will require it from DI then.
namespaceApp;
class IdentityHandler implements \Nette\Security\IdentityHandler
{
publicfunctionsleep(...) { ... } // real workpublicfunctionwakeup(...){ ... } // real work
}
security:identityHandler:App\IdentityHandler
The text was updated successfully, but these errors were encountered:
dakur
changed the title
Decouple IdentityHandler from Authenticator – make it a service
Decouple IdentityHandler from AuthenticatorMar 29, 2022
We use custom authenticators (independent on
Nette\Security\Authenticator
interface) which produce instances ofNette\Security\IIdentity
so that it can be used forUser#login($identity)
afterwards. Inside of the identity, there is an object which need to be (de)serialized in a special way.IdentityHandler
seems perfect for this job.Sadly, in current implementation,
IdentityHandler
is only applied if it's implemented withinAuthenticator
, but not standalone. As a workaround, I can:IdentityHandler
as well (see below)User
at allExample of fake authenticator:
Suggestion
Support
IdentityHandler
on its own with a configuration param.User
will require it from DI then.The text was updated successfully, but these errors were encountered: