Exception Handling in SimpleAuthentificator

Hi,

can anyone explan how is exception handling done in SimpleAuthetificator?

My problem:
I have an extension with a SimpleAuthentificator, which authenticates the certificates in the onConnect() method, this extension has the highest priority.

An other extension has a ClientLifecycleEventListener, which listen to the event onAuthenticationSuccessful() and do some stuff…

What happens in the listener, if an exception occurs in the authenticator, for example a RuntimeException? Is there a way to respond to that?

Has connection to

Hi juggie,

if the onConnect() method of the SimpleAuthenticator throws an exception that is not handled by the custom code then the authentication fails for the client and onAuthenticationSuccessful() of the ClientLifecycleEventListener will never be called.

Instead you can override onDisconnect or more specific onAuthenticationFailedDisconnect() in the listener to react to it.

But it is recommended that you handle exceptions and call failAuthentication() on the output of the Authenticator

P.S. priority is only important if you have multiple extensions that implements the same interfaces. E.g. multiple extensions that have an Authenticator. Then these will be called by priority.

Regards
Flo

3 Likes