Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty custom LoginService question

What jetty version? those line numbers don't match 9.4 or 9.2 releases?
More of the output would also be handy.

However, looking at it, I think the XmlConfiguration has been able to load your Login Service OK, except that it is not being seen as an instance of LoginService and thus a setter method cannot be found for it.

Your class needs to be on the container classpath and not in your webapp.  If you really want to have it in your webapp, you need to make sure that you setup system/server classes so that the Jetty classes used by it are exposed to the webapp and cannot be overwritten by the webapp.    Perhaps try setting setParentLoaderPriority(true) on the context.... but I'd recommend at least getting it to work on the container classpath before trying anything like that.

regards



On 24 May 2017 at 04:25, Ashley Mort <ashley.mort@xxxxxxxxx> wrote:

Can anyone point me to a working example of a custom LoginService for Jetty?

I am just trying to do something as simple as making a copy of HashLoginService in a package in my project then reference that class from jetty-web.xml. When I do so, I always get:

2017-05-23 21:16:36.511:WARN:oejw.WebAppContext:main: Failed startup of context o.e.j.w.WebAppContext@60c6f5b{/,file:///D:/jetty-distribution-9.4.2.v2
0170220/webapps/a5-1.0-SNAPSHOT/,UNAVAILABLE}{D:\jetty-distribution-9.4.2.v20170220\webapps\a5-1.0-SNAPSHOT}
java.lang.NoSuchMethodException: class org.eclipse.jetty.security.ConstraintSecurityHandler.setAuthenticator(class org.eclipse.jetty.security.authenti
cation.FormAuthenticator)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlConfiguration.java:593)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:411)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.get(XmlConfiguration.java:675)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configure(XmlConfiguration.java:420)

OR

java.lang.NoSuchMethodException: class org.eclipse.jetty.security.ConstraintSecu
rityHandler.setLoginService(class org.overlord.fta.login.MyLoginService)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.set(XmlC
onfiguration.java:579)
        at org.eclipse.jetty.xml.XmlConfiguration$JettyXmlConfiguration.configur
e(XmlConfiguration.java:384)

Is this some classloader issue that I'm not understanding? Can anyone help me get a custom LoginService working? Thanks so much!

I have tried the code at the following github project which is similar to my project setup but that doesn't work either (same errors). https://github.com/EricWittmann/fuse-test-apps/tree/master/fta-custom-login-service-war

Below is my jetty-web.xml:

  <Get name="securityHandler">
    <Set name="loginService">
      <!-- THIS WORKS USING JETTY'S HASHLOGINSERVICE -->
      <New class="org.eclipse.jetty.security.HashLoginService">
        <Set name="name">testrealm</Set>
        <Set name="config">
        <SystemProperty name="jetty.base"
                        default="." />/etc/realm.properties</Set>
      </New>   
      <!-- THIS WON'T WORK USING MY HASHLOGINSERVICE -->   
      <!--New class="com.mysite.HashLoginService">
        <Set name="name">testrealm</Set>
        <Set name="config">
        <SystemProperty name="jetty.base"
                        default="." />/etc/realm.properties</Set>
      </New-->
  </Get>

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--

Back to the top