You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by pratibhaG <pr...@in2m.com> on 2008/06/30 08:14:49 UTC
How to send custom message to client for
authentication/authorization error
I want to send a custom message to client in case of authentication or
authorization failure. Something like this:
<response><status>error<status><message>Not authorized</message></response>
Currently the client gets following message:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 401 </title>
</head>
<body>
<h2>HTTP ERROR: 401</h2>
<pre>UNAUTHORIZED</pre>
<p>RequestURI=/example/</p>
<p><small> http://jetty.mortbay.org/ Powered by Jetty:// </small></p>
</body>
</html>
at smx logs I get this:
DEBUG - JettyContextManager - Dispatching job:
SCEP@12965226[d=true,io=0,w=true,b=false|false]
DEBUG - JettyContextManager - Dispatching job:
SCEP@12965226[d=true,io=1,w=true,b=false|false]
DEBUG - JAASAuthenticationService - Authenticating 'smx1' with 'smx'
DEBUG - JaasUserRealm - Login Failed
javax.security.auth.login.FailedLoginException: User does not exist
at
org.apache.servicemix.jbi.security.login.PropertiesLoginModule.login(PropertiesLoginModule.java:116)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
at
javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
at
javax.security.auth.login.LoginContext$4.run(LoginContext.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at
javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
at
javax.security.auth.login.LoginContext.login(LoginContext.java:579)
at
org.apache.servicemix.jbi.security.auth.impl.JAASAuthenticationService.authenticate(JAASAuthenticationService.java:67)
at
org.apache.servicemix.http.jetty.JaasUserRealm.authenticate(JaasUserRealm.java:106)
at
org.mortbay.jetty.security.BasicAuthenticator.authenticate(BasicAuthenticator.java:62)
at
org.mortbay.jetty.security.SecurityHandler.check(SecurityHandler.java:441)
at
org.mortbay.jetty.security.SecurityHandler.checkSecurityConstraints(SecurityHandler.java:269)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:191)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:211)
at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:313)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:844)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:644)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)
WARN - jetty - AUTH FAILURE: user smx1
DEBUG - JettyContextManager - Dispatching job:
SCEP@12965226[d=true,io=1,w=true,b=false|false]
DEBUG - JettyContextManager - Dispatching job:
SCEP@12965226[d=true,io=1,w=true,b=false|false]
How can I customize this message? Can I use any exception handler at http
consumer?
Pratibha
--
View this message in context: http://www.nabble.com/How-to-send-custom-message-to-client-for-authentication-authorization-error-tp18189315p18189315.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.