Skip to content
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

Custom CallBackHandlerFactory is not Working on 4.2.0 #2125

Closed
KasuniHemasika opened this issue Aug 23, 2023 · 1 comment
Closed

Custom CallBackHandlerFactory is not Working on 4.2.0 #2125

KasuniHemasika opened this issue Aug 23, 2023 · 1 comment

Comments

@KasuniHemasika
Copy link

Description

With the following configuration a custom callback factory can be enabled in APIM.

[authentication.framework.extensions]
callback_factory = "org.wso2.carbon.identity.custom.callback.userstore.CustomUserStoreOrderCallbackFactory"

This was working without any issues in APIM 4.0.0. However, in APIM 4.2.0, after enabling this, when trying to log into the publisher the with the admin user an error occurred. The following error was observed wso2carbon.log file.

TID: [-1234] [] [2023-07-19 12:57:17,936] DEBUG {org.wso2.carbon.user.core.common.AbstractUserStoreManager} - Listing users who having value as PRIMARY/admin for the claim http://wso2.org/claims/username
TID: [-1234] [] [2023-07-19 12:57:17,937] DEBUG {org.wso2.carbon.user.core.common.AbstractUserStoreManager} - Pre listener user list: [] for domain: PRIMARY
TID: [-1234] [] [2023-07-19 12:57:17,937] DEBUG {org.wso2.carbon.user.core.common.AbstractUserStoreManager} - Domain found in claim value. Searching only in the PRIMARY for possible matches
TID: [-1234] [] [2023-07-19 12:57:17,943] DEBUG {org.wso2.carbon.user.core.common.AbstractUserStoreManager} - List of filtered users for: PRIMARY : [[d561b013-ebe6-4441-8458-196598303066]]
TID: [-1234] [] [2023-07-19 12:57:17,948] DEBUG {org.wso2.carbon.user.core.common.AbstractUserStoreManager} - Post listener user list: [admin] for domain: PRIMARY
TID: [-1234] [] [2023-07-19 12:57:17,954] ERROR {org.wso2.carbon.user.core.common.AbstractUserStoreManager} - Error occurred while authenticating user: admin java.lang.NullPointerException: Cannot invoke "org.wso2.carbon.user.api.RealmConfiguration.getUserStoreProperty(String)" because "realmConfig" is null
    at org.wso2.carbon.user.core.util.UserCoreUtil.getDomainName(UserCoreUtil.java:659)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.getMyDomainName(AbstractUserStoreManager.java:9421)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticateInternalWithID(AbstractUserStoreManager.java:11265)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticateInternalIterationWithID(AbstractUserStoreManager.java:11077)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.lambda$authenticateWithID$18(AbstractUserStoreManager.java:11053)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticateWithID(AbstractUserStoreManager.java:11051)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.lambda$authenticateWithID$17(AbstractUserStoreManager.java:11020)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticateWithID(AbstractUserStoreManager.java:11011)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.generateUserStoreChainWithID(AbstractUserStoreManager.java:11141)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticateInternalIterationWithID(AbstractUserStoreManager.java:11073)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.lambda$authenticateWithID$18(AbstractUserStoreManager.java:11053)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticateWithID(AbstractUserStoreManager.java:11051)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.lambda$authenticateWithID$17(AbstractUserStoreManager.java:11020)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.authenticateWithID(AbstractUserStoreManager.java:11011)
    at org.wso2.carbon.identity.application.authenticator.basicauth.BasicAuthenticator.processAuthenticationResponse(BasicAuthenticator.java:578)
    at org.wso2.carbon.identity.application.authentication.framework.AbstractApplicationAuthenticator.process(AbstractApplicationAuthenticator.java:92)
    at org.wso2.carbon.identity.application.authenticator.basicauth.BasicAuthenticator.process(BasicAuthenticator.java:165)
    at org.wso2.carbon.identity.application.authentication.framework.handler.step.impl.DefaultStepHandler.doAuthentication(DefaultStepHandler.java:579)
    at org.wso2.carbon.identity.application.authentication.framework.handler.step.impl.DefaultStepHandler.handleResponse(DefaultStepHandler.java:548)
    at org.wso2.carbon.identity.application.authentication.framework.handler.step.impl.DefaultStepHandler.handle(DefaultStepHandler.java:215)
    at org.wso2.carbon.identity.application.authentication.framework.handler.sequence.impl.DefaultStepBasedSequenceHandler.handle(DefaultStepBasedSequenceHandler.java:194)
    at org.wso2.carbon.identity.application.authentication.framework.handler.sequence.impl.GraphBasedSequenceHandler.handle(GraphBasedSequenceHandler.java:115)
    at org.wso2.carbon.identity.application.authentication.framework.handler.request.impl.DefaultAuthenticationRequestHandler.handle(DefaultAuthenticationRequestHandler.java:190)
    at org.wso2.carbon.identity.application.authentication.framework.handler.request.impl.DefaultRequestCoordinator.handle(DefaultRequestCoordinator.java:281)
    at org.wso2.carbon.identity.application.authentication.framework.servlet.CommonAuthenticationServlet.doPost(CommonAuthenticationServlet.java:57)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:696)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37)
    at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
    at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
    at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.owasp.csrfguard.CsrfGuardFilter.doFilter(CsrfGuardFilter.java:72)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.wso2.carbon.tomcat.ext.filter.CharacterSetFilter.doFilter(CharacterSetFilter.java:65)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:126)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.wso2.carbon.identity.captcha.filter.CaptchaFilter.doFilter(CaptchaFilter.java:68)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:177)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.wso2.carbon.identity.context.rewrite.valve.TenantContextRewriteValve.invoke(TenantContextRewriteValve.java:119)
    at org.wso2.carbon.identity.context.rewrite.valve.OrganizationContextRewriteValve.invoke(OrganizationContextRewriteValve.java:116)
    at org.wso2.carbon.tomcat.ext.valves.SameSiteCookieValve.invoke(SameSiteCookieValve.java:38)
    at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:165)
    at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:111)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:106)
    at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49)
    at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:67)
    at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:152)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
    at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:63)
    at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:137)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:891)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1784)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Thread.java:833)

Steps to Reproduce

  • Download APIM 4.2.0 and update into 4.2.0.16.
  • Add the custom callback implementation jar into /repository/components/lib/ directory.
  • Add the mentioned configuration into deployment.toml file.
  • Start the APIM server and try to log into the publisher portal with admin user.

Affected Component

APIM

Version

4.2.0

Environment Details (with versions)

No response

Relevant Log Output

No response

Related Issues

No response

Suggested Labels

No response

@hisanhunais
Copy link

Fix done via [1]. Hence, closing the issue

[1] wso2/carbon-kernel#3658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants