Search code examples
wso2wso2-identity-server

WS02 post authentication handler not registered


I'm trying to enable a new post authentication handler in order to use the authenticated user info. I tried to follow this guide: https://docs.wso2.com/display/IS570/Writing+a+Post-Authentication+Handler#WritingaPost-AuthenticationHandler-ByreturningaPostAuthnHandlerFlowStatus using the sample code in https://github.com/wso2/samples-is/tree/master/etc/sample-post-authentication-handler

So I created the jar of sample-post-authentication-handler and i putted it in the dropins server folder, and disclaimer.jsp in the authenticationendpoint folder. I run the server and I logged with a sample application, but the handler doesn't fire. I tried to put logs on DisclaimerPostAuthnHandlerServiceComponent and DisclaimerPostAuthenticationHandler, I enabled the log4j log level of the package. In the end, I tried to log with system.out, but I never see in the server log something about the registration of the handler. I think the DisclaimerPostAuthnHandlerServiceComponent is ignored, so the handler is not registered.

Where I'm wrong?

I'm using wso2 5.7.0 and I'm really new to wso2 and osgi.


Solution

  • Seems you have built the master branch source code https://github.com/wso2/samples-is/tree/master/etc/sample-post-authentication-handler and obtained the jar and tried to use it with IS-5.7.0 But, the samples are available in the master branch might not compatible with the previous releases due to dependency updates.

    When I tried the sample-post-authentication-handler jar file built from the master branch, it won't get activated properly in IS-5.7.0. It's in installed state due to the failure of resolving required dependencies. enter image description here

    NOTE: Check the "Useful OSGi commands to debug" section of https://medium.com/p/482f6e5e3ea5 to understand how we can check whether the OSGi bundles are activated or not.

    Can you try the sample-post-authentication-handler in tag v1.0.0? It's compatible with Is-5.7.0 https://github.com/wso2/samples-is/tree/v1.0.0/sample-post-authentication-handler/src/main