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

bug(jans-auth-server): custom pages are not found #1318

Closed
jgomer2001 opened this issue May 10, 2022 · 1 comment
Closed

bug(jans-auth-server): custom pages are not found #1318

jgomer2001 opened this issue May 10, 2022 · 1 comment
Assignees
Labels
comp-jans-auth-server Component affected by issue or PR needs-triage Issue or PR yet to be triaged. Add more labels or details that will help during triage review.

Comments

@jgomer2001
Copy link
Contributor

Pages in /custom/pages seem not to be recognized. Steps to reproduce:

Edit basic script this way:

    def getPageForStep(self, configurationAttributes, step):
        return "/mylogin.xhtml"

Then do:

$ cd /opt/jans/jetty/jans-auth/webapps
$ jar -xf jans-auth.war login.xhtml
$ mv login.xhtml ../custom/pages/mylogin.xhtml

Issue an authn request using acr=basic, the following appears in the logs:

==> jans-auth_script.log <==
2022-05-10 21:14:34,381 DEBUG [qtp1364913072-17] cd1ea403-fd9f-45f1-9960-e8864b39bc7d [jans.as.server.service.external.ExternalAuthenticationService] (ExternalAuthenticationService.java:169) - Executing python 'isValidAuthenticationMethod' authenticator method
2022-05-10 21:14:34,406 INFO  [qtp1364913072-17] cd1ea403-fd9f-45f1-9960-e8864b39bc7d [io.jans.service.PythonService$PythonLoggerOutputStream] (PythonService.java:243) - Basic. Prepare for Step 1

==> jans-auth.log <==
2022-05-10 21:14:34,472 ERROR [qtp1364913072-17] cd1ea403-fd9f-45f1-9960-e8864b39bc7d [io.jans.as.server.exception.GlobalExceptionHandler] (GlobalExceptionHandler.java:55) - /mylogin.xhtml Not Found in ExternalContext as a Resource
jakarta.faces.FacesException: /mylogin.xhtml Not Found in ExternalContext as a Resource
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:98) ~[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.render(LifecycleImpl.java:178) ~[jakarta.faces-3.0.2.jar:3.0.2]
	at jakarta.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:682) ~[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:1624) ~[?:?]
	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.8.jar:11.0.8]
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1594) ~[jetty-servlet-11.0.8.jar:11.0.8]
	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.8.jar:11.0.8]
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1594) ~[jetty-servlet-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:170) ~[websocket-servlet-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) ~[jetty-servlet-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1594) ~[jetty-servlet-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:506) ~[jetty-servlet-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578) ~[jetty-security-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1571) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1375) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:463) ~[jetty-servlet-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1544) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1297) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:192) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:51) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.Server.handle(Server.java:562) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282) ~[jetty-server-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:319) ~[jetty-io-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100) ~[jetty-io-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53) ~[jetty-io-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:412) ~[jetty-util-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:381) ~[jetty-util-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:268) ~[jetty-util-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.produce(AdaptiveExecutionStrategy.java:190) ~[jetty-util-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:894) [jetty-util-11.0.8.jar:11.0.8]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1038) [jetty-util-11.0.8.jar:11.0.8]
	at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: com.sun.faces.context.FacesFileNotFoundException: /mylogin.xhtml Not Found in ExternalContext as a Resource
	at com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:201) ~[jakarta.faces-3.0.2.jar:3.0.2]
	at com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:292) ~[jakarta.faces-3.0.2.jar:3.0.2]
	at com.sun.faces.facelets.impl.DefaultFaceletFactory.getFacelet(DefaultFaceletFactory.java:173) ~[jakarta.faces-3.0.2.jar:3.0.2]
	at com.sun.faces.application.view.FaceletViewHandlingStrategy.buildView(FaceletViewHandlingStrategy.java:345) ~[jakarta.faces-3.0.2.jar:3.0.2]
	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:70) ~[jakarta.faces-3.0.2.jar:3.0.2]
	... 48 more

Now put the same page inside war:

$ cd /opt/jans/jetty/jans-auth/webapps
$ mv ../custom/pages/mylogin.xhtml mylogin.xhtml
$ jar -uf jans-auth.war mylogin.xhtml
$ rm mylogin.xhtml
$ /opt/dist/scripts/jans-auth restart

Issue the authn request again. It works

@jgomer2001 jgomer2001 changed the title bug(jans-auth-server): custom pages are not working bug(jans-auth-server): custom pages are not found May 10, 2022
@jgomer2001 jgomer2001 added comp-jans-auth-server Component affected by issue or PR needs-triage Issue or PR yet to be triaged. Add more labels or details that will help during triage review. labels May 10, 2022
yurem added a commit that referenced this issue May 12, 2022
fix: bug(jans-auth-server): custom pages are not found #1318
@yurem
Copy link
Contributor

yurem commented May 12, 2022

@jgomer2001 It should work well with new jans-auth.war

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-jans-auth-server Component affected by issue or PR needs-triage Issue or PR yet to be triaged. Add more labels or details that will help during triage review.
Projects
None yet
Development

No branches or pull requests

2 participants