JanssenProject / jans

An open source enterprise digital identity platform for CIAM or workforce... Janssen is a distribution of standards-based, developer friendly, components that are engineered to work together in any cloud. #OAuth #OpenID #FIDO
https://docs.jans.io
Apache License 2.0
471 stars 75 forks source link

fix(jans-auth-server): failed to authenticate user when Twilio script is enabled. #4715

Closed MohitMaliFtechiz closed 1 year ago

MohitMaliFtechiz commented 1 year ago

Describe the bug Failed to authenticate user when Twilio script is enabled.

To Reproduce Steps to reproduce the behaviour:

  1. install jans
  2. launch tui
  3. enable Twilio script
  4. set Twilio script as default acr. 5 . try to authenticate any user/admin.

Expected behaviour

User must be authenticate via getting code.

Actual behaviour

user failed to authenticate

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Logs

2023-04-25 09:16:25,135 INFO  [qtp1364913072-17] 45f492ad-0f3c-42bc-a60d-087a6a69dff2 [io.jans.service.PythonService$PythonLoggerOutputStream] (PythonService.java:244) - TwilioSMS. Prepare for Step 1
2023-04-25 09:16:35,443 INFO  [qtp1364913072-13] 1a191c20-f76f-4971-80e4-ea6fb2eeef55 [io.jans.service.PythonService$PythonLoggerOutputStream] (PythonService.java:244) - ==============================================
2023-04-25 09:16:35,444 INFO  [qtp1364913072-13] 1a191c20-f76f-4971-80e4-ea6fb2eeef55 [io.jans.service.PythonService$PythonLoggerOutputStream] (PythonService.java:244) - ====TWILIO SMS AUTHENCATION===================
2023-04-25 09:16:35,444 INFO  [qtp1364913072-13] 1a191c20-f76f-4971-80e4-ea6fb2eeef55 [io.jans.service.PythonService$PythonLoggerOutputStream] (PythonService.java:244) - ==============================================
2023-04-25 09:16:35,446 INFO  [qtp1364913072-13] 1a191c20-f76f-4971-80e4-ea6fb2eeef55 [io.jans.service.PythonService$PythonLoggerOutputStream] (PythonService.java:244) - TwilioSMS. form_response_passcode: None
2023-04-25 09:16:35,446 INFO  [qtp1364913072-13] 1a191c20-f76f-4971-80e4-ea6fb2eeef55 [io.jans.service.PythonService$PythonLoggerOutputStream] (PythonService.java:244) - ==============================================
2023-04-25 09:16:35,446 INFO  [qtp1364913072-13] 1a191c20-f76f-4971-80e4-ea6fb2eeef55 [io.jans.service.PythonService$PythonLoggerOutputStream] (PythonService.java:244) - =TWILIO SMS STEP 1 | Password Authentication==
2023-04-25 09:16:35,446 INFO  [qtp1364913072-13] 1a191c20-f76f-4971-80e4-ea6fb2eeef55 [io.jans.service.PythonService$PythonLoggerOutputStream] (PythonService.java:244) - ==============================================
2023-04-25 09:16:35,530 ERROR [qtp1364913072-13] 1a191c20-f76f-4971-80e4-ea6fb2eeef55 [jans.as.server.service.external.ExternalAuthenticationService] (ExternalAuthenticationService.java:224) - Authenticate
com.twilio.exception.ApiException: Authenticate
        at com.twilio.rest.api.v2010.account.MessageCreator.create(MessageCreator.java:416) ~[twilio.jar:?]
        at com.twilio.rest.api.v2010.account.MessageCreator.create(MessageCreator.java:25) ~[twilio.jar:?]
        at com.twilio.base.Creator.create(Creator.java:45) ~[twilio.jar:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:190) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:208) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyObject.__call__(PyObject.java:461) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyObject.__call__(PyObject.java:465) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyMethod.__call__(PyMethod.java:126) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.pycode._pyx3.authenticate$9(twilio_sms.py:217) ~[?:?]
        at org.python.pycode._pyx3.call_function(twilio_sms.py) ~[?:?]
        at org.python.core.PyTableCode.call(PyTableCode.java:173) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyBaseCode.call(PyBaseCode.java:306) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyBaseCode.call(PyBaseCode.java:197) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyFunction.__call__(PyFunction.java:485) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyMethod.__call__(PyMethod.java:228) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyMethod.__call__(PyMethod.java:218) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyMethod.__call__(PyMethod.java:213) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyObject._jcallexc(PyObject.java:3565) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.core.PyObject._jcall(PyObject.java:3598) ~[jython-standalone-2.7.3.jar:2.7.3b1-SNAPSHOT]
        at org.python.proxies.__main__$PersonAuthentication$3.authenticate(Unknown Source) ~[?:?]
        at io.jans.as.server.service.external.ExternalAuthenticationService.executeExternalAuthenticate(ExternalAuthenticationService.java:220) ~[classes/:?]
        at io.jans.as.server.service.external.ExternalAuthenticationService$Proxy$_$$_WeldClientProxy.executeExternalAuthenticate(Unknown Source) ~[classes/:?]
        at io.jans.as.server.auth.Authenticator.userAuthenticationInteractive(Authenticator.java:346) ~[classes/:?]
        at io.jans.as.server.auth.Authenticator.authenticateImpl(Authenticator.java:227) ~[classes/:?]
        at io.jans.as.server.auth.Authenticator.authenticate(Authenticator.java:139) ~[classes/:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
        at org.apache.el.parser.AstValue.invoke(AstValue.java:252) ~[org.mortbay.jasper.apache-el-10.0.14.jar:10.0.14]
        at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:266) ~[org.mortbay.jasper.apache-el-10.0.14.jar:10.0.14]
        at org.jboss.weld.module.web.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40) ~[weld-web-4.0.3.Final.jar:4.0.3.Final]
        at org.jboss.weld.module.web.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) ~[weld-web-4.0.3.Final.jar:4.0.3.Final]
        at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:70) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:67) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at com.sun.faces.application.ActionListenerImpl.getNavigationOutcome(ActionListenerImpl.java:75) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:64) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at jakarta.faces.component.UICommand.broadcast(UICommand.java:213) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at jakarta.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:852) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at jakarta.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1329) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:56) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:72) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:159) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at jakarta.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:681) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:437) ~[jakarta.faces-3.0.2.jar:3.0.2]
        at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1419) ~[?:?]
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764) ~[?:?]
        at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665) ~[?:?]
        at io.jans.as.server.audit.debug.ServletLoggingFilter.doFilter(ServletLoggingFilter.java:71) ~[classes/:?]
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:210) ~[jetty-servlet-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) ~[jetty-servlet-11.0.11.jar:11.0.11]
        at io.jans.as.server.filter.CorrelationIdFilter.doFilter(CorrelationIdFilter.java:49) ~[classes/:?]
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) ~[jetty-servlet-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) ~[jetty-servlet-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:170) ~[websocket-servlet-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) ~[jetty-servlet-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) ~[jetty-servlet-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527) ~[jetty-servlet-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131) ~[?:?]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578) ~[jetty-security-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) ~[?:?]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223) ~[?:?]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1571) ~[jetty-server-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221) ~[?:?]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1375) ~[jetty-server-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176) ~[?:?]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484) ~[jetty-servlet-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1544) ~[jetty-server-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174) ~[?:?]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1297) ~[jetty-server-11.0.11.jar:11.0.11]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129) ~[?:?]
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:192) ~[?:?]
        at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51) ~[?:?]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) ~[?:?]
        at org.eclipse.jetty.server.Server.handle(Server.java:562) ~[?:?]
        at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505) ~[?:?]
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762) ~[?:?]
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497) ~[?:?]
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282) ~[?:?]
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:319) ~[?:?]
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100) ~[?:?]
        at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53) ~[?:?]
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:412) ~[?:?]
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:381) ~[?:?]
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:268) ~[?:?]
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:138) ~[?:?]
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:407) ~[?:?]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:894) ~[?:?]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1038) ~[?:?]
        at java.lang.Thread.run(Thread.java:829) ~[?:?] 
maduvena commented 1 year ago

API creds must be wrong. Latest test works