Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Modification of Status Code/Response Header

Thank you for your reply!
It is located in the webapp. Where should I put it?
HK

Am 13.08.2013 19:12, schrieb Jesse McConnell:
Where is your authenticator class located?  jetty-security may be on the classpath but if you are trying to configure this inside of the webapp classloader then classloader isolation may be a factor.

jesse

--
jesse mcconnell
jesse.mcconnell@xxxxxxxxx


On Tue, Aug 13, 2013 at 11:47 AM, Harald Köhler <harald_koehler@xxxxxxxxxxx> wrote:
I figured out how to do this using a custom Authenticator "com.example.MyAuthenticator". I copied the code from org.eclipse.jetty.security.authentication.BasicAuthenticator (http://grepcode.com/file/repo1.maven.org/maven2/org.eclipse.jetty/jetty-security/8.1.11.v20130520/org/eclipse/jetty/security/authentication/BasicAuthenticator.java?av=f) and with this I can make modifications.
In jetty-web.xml where I defined my securityHandler I just added the following lines:

      <Get name="securityHandler">
        <Set name="loginService">
            <New class="org.eclipse.jetty.security.JDBCLoginService">
                <Set name="name">MyRealm</Set>
                <Set name="config">MyRealm.properties</Set>
            </New>
        </Set>
        <Set name="authenticator">
            <New class="com.example.MyAuthenticator"></New>
        </Set>
    </Get>


But there I run into a new problem:
The class is found and instantiated, but when I try to access any ressource I get:
java.lang.NoClassDefFoundError: org/eclipse/jetty/security/authentication/DeferredAuthentication
    at org.eclipse.jetty.security.authentication.MyAuthenticator.validateRequest(MyAuthenticator.java:43)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:495)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:365)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:722)
Caused by:
java.lang.ClassNotFoundException: org.eclipse.jetty.security.authentication.DeferredAuthentication
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:421)
    at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:383)
    at org.eclipse.jetty.security.authentication.MyAuthenticator.validateRequest(MyAuthenticator.java:43)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:495)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:365)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:926)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:988)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:635)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:722)


I don't know why, jetty-security should be on the classpath.

Any help appreciated! Thanks!


Hello!
I run a Jetty server with Jersey Servlets, configured to need authentication. For authentication I use org.eclipse.jetty.security.JDBCLoginService.
I would like to modify for several reasons the response header from 401 to 403. I tried to use a filter but it seems not to have an effect to the LoginService.
Is there any way to do this with filters?
Or to adapt JDBCLoginService?
Thanks in advance!
HK
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users




_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users




_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top