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

   <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

Back to the top