Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] 9.4: can I get rid of LoginService if no login?

> Your `pr.xml` is enabling the login service.

> Get rid of the entire element


That's what I started with, per my first email, and just re-verified:

This pr.xml:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">

  <Set name="contextPath">/pr</Set>
  <Set name="war"><Property name="jetty.webapps" default="."/>/pr.war</Set>

</Configure>

Results: whole stack this time, noting now that it seems odd for just starting gziphandler:

2022-04-27 18:00:33.039:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.w.WebAppContext@1fb700ee{Phobrain,/pr,file:///tmp/jetty-0_0_0_0-8080-pr_war-_pr-any-16117554634680613243/webapp/,UNAVAILABLE}{/home/epqe/pr_git/pr/jetty-base/webapps/pr.war}
java.lang.IllegalStateException: No LoginService for org.eclipse.jetty.security.authentication.BasicAuthenticator@3e7dd664 in ConstraintSecurityHandler@5b1ebf56{STARTING}
        at org.eclipse.jetty.security.authentication.LoginAuthenticator.setConfiguration(LoginAuthenticator.java:92)
        at org.eclipse.jetty.security.SecurityHandler.doStart(SecurityHandler.java:410)
        at org.eclipse.jetty.security.ConstraintSecurityHandler.doStart(ConstraintSecurityHandler.java:417)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
        at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:120)
        at org.eclipse.jetty.server.session.SessionHandler.doStart(SessionHandler.java:505)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
        at org.eclipse.jetty.server.handler.ScopedHandler.doStart(ScopedHandler.java:120)
        at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:970)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:375)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:375)
        at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1449)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1414)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:911)
        at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:288)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:524)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:117)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
        at org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:426)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
        at org.eclipse.jetty.server.Server.start(Server.java:423)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:97)
        at org.eclipse.jetty.server.Server.doStart(Server.java:387)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
        at org.eclipse.jetty.xml.XmlConfiguration.lambda$main$3(XmlConfiguration.java:1907)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1857)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:218)

On 4/27/22 5:14 PM, Joakim Erdfelt wrote:
Your `pr.xml` is enabling the login service.

Get rid of the entire element

   <Get name="securityHandler">
     <Set name="loginService">
 ....
     </Set>
   </Get>

That is where your requirement is coming from.

Joakim Erdfelt / joakim@xxxxxxxxxxx


On Wed, Apr 27, 2022 at 5:41 PM Bill Ross via jetty-users <jetty-users@xxxxxxxxxxx> wrote:
Thanks!

 > take the <login-config> element out of your web.xml (or however
you've set up the BasicAuthenticator).

It's not in my web.xml, my 'app.xml' (jetty-base/webapps/pr.xml), nor
are there any Login-named classes imported in my java code.

It's a standalone jetty server with compiled with gradle.

== pr.xml:

<Configure class="org.eclipse.jetty.webapp.WebAppContext">

   <Set name="contextPath">/pr</Set>
   <Set name="war"><Property name="jetty.webapps" default="."/>/pr.war</Set>

   <Get name="securityHandler">
     <Set name="loginService">
       <New class="org.eclipse.jetty.security.HashLoginService">
         <Set name="name">Phogit Login</Set>
         <Set name="config"><SystemProperty name="jetty.base"
default="."/>/etc/realm.properties</Set>
             <!-- To enable reload of realm when properties change,
uncomment the following lines -->
             <!-- changing refreshInterval (in seconds) as
desired                                -->
             <!--
             <Set name="refreshInterval">5</Set>
             <Call name="start"></Call>
             -->
       </New>
     </Set>
     <Set name="authenticator">
       <New
class="org.eclipse.jetty.security.authentication.FormAuthenticator">
         <Set name="alwaysSaveUri">true</Set>
       </New>
     </Set>
     <Set name="checkWelcomeFiles">true</Set>
   </Get>

</Configure>

$ grep -i login jetty-base/start.d/start.ini
#jetty.jaas.login.conf=etc/login.conf

$ find jetty-base

jetty-base
jetty-base/resources
jetty-base/resources/logback.xml
jetty-base/resources/jetty-logging.properties
jetty-base/start.d
jetty-base/start.d/start.ini
jetty-base/webapps
jetty-base/webapps/pr.war
jetty-base/webapps/pr.xml
jetty-base/webapps/ROOT
jetty-base/webapps/ROOT/index.html
jetty-base/etc
jetty-base/etc/keystore
jetty-base/etc/realm.properties [size 0]
jetty-base/modules
jetty-base/lib
jetty-base/lib/ext
jetty-base/lib/ext/postgresql-9.4-1203.jdbc42.jar
jetty-base/lib/ext/c3p0-0.9.5.5.jar
jetty-base/lib/ext/mchange-commons-java-0.2.19.jar
jetty-base/lib/alpn
jetty-base/lib/alpn/alpn-boot-8.1.12.v20180117.jar
jetty-base/lib/logging
jetty-base/lib/logging/slf4j-api-1.6.6.jar
jetty-base/lib/logging/logback-core-1.0.7.jar

On 4/27/22 12:51 AM, Bill Ross wrote:
> I'm trying to simplify before open-sourcing. I used to have a
> HashLogin, and it seems I can't get rid of the requirement. E.g. it
> wants the securityHandler, and an empty
> jetty-base/etc/realm.properties is needed at least.
>
> 9.4
>
> Thanks,
>
> Bill
>
>
> I seem to need this in jetty-base/webapps/app.xml:
>
>   <Get name="securityHandler">
>     <Set name="loginService">
>         <New class="org.eclipse.jetty.security.HashLoginService">
>
>           ...
>
>     </Set>
>     <Set name="authenticator">
>       <New
> class="org.eclipse.jetty.security.authentication.FormAuthenticator">
>         <Set name="alwaysSaveUri">true</Set>
>       </New>
>     </Set>
>     <Set name="checkWelcomeFiles">true</Set>
>   </Get>
>
> java.lang.IllegalStateException: No LoginService for
> org.eclipse.jetty.security.authentication.BasicAuthenticator@77825085
> in ConstraintSecurityHandler@3568f9d2{STARTING}
>         at
> org.eclipse.jetty.security.authentication.LoginAuthenticator.setConfiguration(LoginAuthenticator.java:92)
>         at
> org.eclipse.jetty.security.SecurityHandler.doStart(SecurityHandler.java:410)
>         at
> org.eclipse.jetty.security.ConstraintSecurityHandler.doStart(ConstraintSecurityHandler.java:417)
>
--
Phobrain.com
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/jetty-users
--
Phobrain.com

Back to the top