[JBoss Seam] - It's a bug
by alllle
I had the same problem and found out that the BASIC auth code is pretty much borken in Seam 2.0GA (not sure about early versions).
[The Problems]
The code that causing the problem is in AuthenticationFilter.processBasicAuth(). The current code looks like:
| private void processBasicAuth(HttpServletRequest request,
| HttpServletResponse response, FilterChain chain)
| throws IOException, ServletException
| {
| Problem 1
| Context ctx = new SessionContext( new ServletRequestSessionMap(request) );
| Identity identity = (Identity) ctx.get(Identity.class);
|
| boolean requireAuth = false;
|
| String header = request.getHeader("Authorization");
| if (header != null && header.startsWith("Basic "))
| {
| String base64Token = header.substring(6);
| String token = new String(Base64.decode(base64Token));
|
| String username = "";
| String password = "";
| int delim = token.indexOf(":");
|
| if (delim != -1)
| {
| username = token.substring(0, delim);
| password = token.substring(delim + 1);
| }
|
| // Only reauthenticate if username doesn't match Identity.username and user isn't authenticated
| Problem 2
| if (!username.equals(identity.getUsername()) || !identity.isLoggedIn())
| {
| identity.setUsername(username);
| identity.setPassword(password);
| }
|
| }
|
| if (!identity.isLoggedIn() && !identity.isCredentialsSet())
| {
| requireAuth = true;
| }
|
| try
| {
| if (!requireAuth)
| {
| chain.doFilter(request, response);
| return;
| }
| }
| catch (NotLoggedInException ex)
| {
| requireAuth = true;
| }
|
| if (requireAuth && !identity.isLoggedIn())
| {
| response.addHeader("WWW-Authenticate", "Basic realm=\"" + realm + "\"");
| response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Not authorized");
| }
| }
|
As shown in the above code with red title and bold texts, two problems exist.
Problem 1:
The Identity object is fetched from a brand new SessionContext which returns null if it is the first time the user access a site and the page accessed is protected by BASIC auth. This results in the NPE mentioned in the previous posts, which also has the effect of, if you have the seam-debug on, remembering this exception and redirect to the debug page after you are properly authenticated.
Problem 2
The username and password are parsed correctly and assigned to the identity object, however, it never calls the identity.authenticate() to actually perform the authentication!!
[The workaround]
Create a application component with the same name to fix the logic. Two changes are required:
Change components.xml file
Make sure your components.xml contains a line like this:
| <web:authentication-filter url-pattern="*.seam" auth-type="basic" realm="My App" precedence="0"/>
|
What is important is the precedence="0" attribute. It makes sure that the component is initialized with the BUILT_IN precedence.
Create your own substitute component to fix the problem
Using the code below, deploy with your app to shadow the built in AuthenticationFilter component:
| package com.mycompany.myapp.util;
|
| import static org.jboss.seam.ScopeType.APPLICATION;
|
| import java.io.IOException;
|
| import javax.security.auth.login.LoginException;
| import javax.servlet.FilterChain;
| import javax.servlet.ServletException;
| import javax.servlet.ServletRequest;
| import javax.servlet.ServletResponse;
| import javax.servlet.http.HttpServletRequest;
| import javax.servlet.http.HttpServletResponse;
|
| import org.jboss.seam.Seam;
| import org.jboss.seam.annotations.Install;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.annotations.intercept.BypassInterceptors;
| import org.jboss.seam.annotations.web.Filter;
| import org.jboss.seam.log.Log;
| import org.jboss.seam.security.Identity;
| import org.jboss.seam.security.NotLoggedInException;
| import org.jboss.seam.servlet.ContextualHttpServletRequest;
| import org.jboss.seam.util.Base64;
| import org.jboss.seam.web.AuthenticationFilter;
|
| /**
| * Fix bug in the Seam AuthenticationFilter when handling the BASIC HTTP authentication.
| *
| * Overwrites the BUILT_IN component with the same name.
| *
| * @author Alan Feng
| */
|
| @Scope(APPLICATION)
| @Name("org.jboss.seam.web.authenticationFilter")
| @Install(precedence = Install.APPLICATION)
| @BypassInterceptors
| @Filter(within = "org.jboss.seam.web.exceptionFilter")
|
| public class AuthenticaitonFilterFix extends AuthenticationFilter {
|
| private static final String AUTH_TYPE_BASIC = "basic";
|
| @Logger
| private Log log;
|
| @Override
| public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException,
| ServletException {
| if (!(request instanceof HttpServletRequest)) {
| throw new ServletException("This filter can only process HttpServletRequest requests");
| }
|
| HttpServletRequest httpRequest = (HttpServletRequest) request;
| HttpServletResponse httpResponse = (HttpServletResponse) response;
|
| if (AUTH_TYPE_BASIC.equals(getAuthType()))
| processBasicAuthFix(httpRequest, httpResponse, chain); // invoke the fix
| else
| super.doFilter(request, response, chain);
| }
|
| /**
| * Fixes the bug that does not resolve the Identity object properly, which causes the NPE.
| *
| * @param request
| * @param response
| * @param chain
| * @throws IOException
| * @throws ServletException
| */
| private void processBasicAuthFix(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
| throws IOException, ServletException {
| final Identity identity = (Identity) request.getSession().getAttribute(Seam.getComponentName(Identity.class));
|
| boolean requireAuth = false;
|
| String header = request.getHeader("Authorization");
| if (header != null && header.startsWith("Basic ")) {
| String base64Token = header.substring(6);
| String token = new String(Base64.decode(base64Token));
|
| String username = "";
| String password = "";
| int delim = token.indexOf(":");
|
| if (delim != -1) {
| username = token.substring(0, delim);
| password = token.substring(delim + 1);
| }
|
| // Only reauthenticate if username doesn't match Identity.username and user isn't
| // authenticated
| if (!username.equals(identity.getUsername()) || !identity.isLoggedIn()) {
| identity.setUsername(username);
| identity.setPassword(password);
|
| // HERE we are invoking the authentication, which does JAAS login
| try {
| new ContextualHttpServletRequest(request) {
| @Override
| public void process() throws ServletException, IOException, LoginException {
| identity.authenticate();
| }
| }.run();
| } catch (Exception ex) {
| log.error("Error authenticating: " + ex.getMessage());
| requireAuth = true;
| }
|
| }
| }
|
| if (!identity.isLoggedIn() && !identity.isCredentialsSet()) {
| requireAuth = true;
| }
|
| try {
| if (!requireAuth) {
| chain.doFilter(request, response);
| return;
| }
| } catch (NotLoggedInException ex) {
| requireAuth = true;
| }
|
| if (requireAuth && !identity.isLoggedIn()) {
| response.addHeader("WWW-Authenticate", "Basic realm=\"" + getRealm() + "\"");
| response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "Not authorized");
| }
| }
| }
|
Important changes are in bold texts above.
I will create a JIRA issue shortly.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124922#4124922
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124922
18 years, 2 months
[Messaging, JMS & JBossMQ] - JMS Problem on clean install of Jboss-4.2.2.GA
by jagthedrummer
Hello everyone. I'm trying to get a very simple JMS example running with a clean install of JBoss-4.2.2.GA. I'm trying to use one of the pre-configured example topics which is registered in JNDI under "topic/testTopic".
I have a simple listener and a simple publisher which both run without throwing any errors on the client side, though some errors are thrown on the server side. When I run the message publishing code it acts like it sends a message, but the listener never gets it.
Here's my code for the listener, the publisher, and the log trace from the period directly after trying to send a message.
If anyone has any ideas on what I'm missing I would appreciate the tip.
Thanks,
Jeremy
Topic Listener:
---------------------------------------------------------------------------
| package com.dcom.cms.node.test;
|
| import javax.jms.*;
| import javax.naming.*;
|
| class TopicListenerTest implements javax.jms.MessageListener {
|
| public static void main(String[] args) throws InterruptedException,
| NamingException, JMSException {
| new TopicListenerTest();
| while (true) {
| System.out.println(".");
| Thread.sleep(10000);
|
| }
| }
|
| public TopicListenerTest() throws NamingException, JMSException {
| InitialContext jndiContext = new InitialContext();
| ConnectionFactory factory = (ConnectionFactory) jndiContext
| .lookup("ConnectionFactory");
| Topic topic = (Topic) jndiContext.lookup("topic/testTopic");
| Connection connect = (Connection) factory.createConnection();
| Session session = ((Connection) connect).createSession(false,
| Session.AUTO_ACKNOWLEDGE);
| MessageConsumer consumer = session.createConsumer(topic);
| consumer.setMessageListener(this);
| connect.start();
| }
|
| public void onMessage(Message message) {
| System.out.println("we have a message");
| }
|
| }
|
|
Topic Publisher:
---------------------------------------------------------------------------
| package com.dcom.cms.node.test;
|
| import javax.jms.*;
| import javax.naming.*;
|
|
| class TopicPublisherTest {
|
| public static void main(String[] args) throws NamingException, JMSException {
| new TopicPublisherTest();
| }
|
| public TopicPublisherTest() throws NamingException, JMSException {
| InitialContext jndiContext = new InitialContext();
| ConnectionFactory factory = (ConnectionFactory) jndiContext.lookup("ConnectionFactory");
| Topic topic = (Topic) jndiContext.lookup("topic/testTopic");
| Connection connect = factory.createConnection( );
| Session session = connect.createSession(true,0);
| MessageProducer producer = session.createProducer(topic);
| TextMessage textMsg = session.createTextMessage( );
| textMsg.setText("testing");
| producer.send(textMsg);
| connect.close( );
| }
|
| }
|
|
Server Log:
---------------------------------------------------------------------------
| 2008-01-30 13:38:51,373 TRACE [org.jboss.mq.il.uil2.UILServerILService] Accepted connection: Socket[addr=/127.0.1.1,port=52621,localport=8093]
| 2008-01-30 13:38:51,373 TRACE [org.jboss.mq.server.TracingInterceptor] CALLED : getThreadGroup
| 2008-01-30 13:38:51,373 TRACE [org.jboss.mq.server.TracingInterceptor] RETURN : getThreadGroup
| 2008-01-30 13:38:51,373 TRACE [org.jboss.mq.il.uil2.SocketManager] start called
| java.lang.Exception: Start stack trace
| at org.jboss.mq.il.uil2.SocketManager.start(SocketManager.java:112)
| at org.jboss.mq.il.uil2.UILServerILService.run(UILServerILService.java:171)
| at java.lang.Thread.run(Thread.java:595)
| 2008-01-30 13:38:51,374 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin ReadTask.run Thread[UIL2.SocketManager.ReadTask#5 client=127.0.1.1:52621,5,JBossMQ Server Threads]
| 2008-01-30 13:38:51,374 DEBUG [org.jboss.mq.il.uil2.SocketManager] Begin WriteTask.run Thread[UIL2.SocketManager.WriteTask#6 client=127.0.1.1:52621,5,JBossMQ Server Threads]
| 2008-01-30 13:38:51,374 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created ObjectOutputStream
| 2008-01-30 13:38:51,443 DEBUG [org.jboss.mq.il.uil2.SocketManager] Created ObjectInputStream
| 2008-01-30 13:38:51,443 TRACE [org.jboss.mq.il.uil2.SocketManager] Read msgType: m_authenticate, msgID: 1
| 2008-01-30 13:38:51,443 TRACE [org.jboss.mq.il.uil2.SocketManager] Read new msg: org.jboss.mq.il.uil2.msgs.CheckUserMsg3116185[msgType: m_authenticate, msgID: 1, error: null]
| 2008-01-30 13:38:51,443 TRACE [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Begin handleMsg, msgType: 22
| 2008-01-30 13:38:51,443 TRACE [org.jboss.mq.server.TracingInterceptor] CALLED : authenticate
| 2008-01-30 13:38:51,443 TRACE [org.jboss.mq.security.ServerSecurityInterceptor] Authenticating user null
| 2008-01-30 13:38:51,444 TRACE [org.jboss.mq.security.SecurityManager] Username: null is authenticated
| 2008-01-30 13:38:51,444 TRACE [org.jboss.mq.security.SecurityManager] Adding group : class org.jboss.security.SimpleGroup Roles(members:j2ee,guest,john)
| 2008-01-30 13:38:51,444 TRACE [org.jboss.mq.server.TracingInterceptor] RETURN : authenticate
| 2008-01-30 13:38:51,444 TRACE [org.jboss.mq.il.uil2.SocketManager] Begin internalSendMessage, one-way msg=org.jboss.mq.il.uil2.msgs.CheckUserMsg3116185[msgType: m_authenticate, msgID: 1, error: null]
| 2008-01-30 13:38:51,444 TRACE [org.jboss.mq.il.uil2.SocketManager] Write msg: org.jboss.mq.il.uil2.msgs.CheckUserMsg3116185[msgType: m_authenticate, msgID: 1, error: null]
| 2008-01-30 13:38:51,444 TRACE [org.jboss.mq.il.uil2.SocketManager] End internalSendMessage, msg=org.jboss.mq.il.uil2.msgs.CheckUserMsg3116185[msgType: m_authenticate, msgID: 1, error: null]
| 2008-01-30 13:38:51,444 TRACE [org.jboss.mq.il.uil2.ServerSocketManagerHandler] End handleMsg, msgType: 22
| 2008-01-30 13:38:51,454 TRACE [org.jboss.mq.il.uil2.SocketManager] Read msgType: m_setSpyDistributedConnection, msgID: 2
| 2008-01-30 13:38:51,455 TRACE [org.jboss.mq.il.uil2.SocketManager] Read new msg: org.jboss.mq.il.uil2.msgs.ConnectionTokenMsg14492623[msgType: m_setSpyDistributedConnection, msgID: 2, error: null]
| 2008-01-30 13:38:51,456 TRACE [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Begin handleMsg, msgType: 15
| 2008-01-30 13:38:51,456 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Setting up the UILClientIL Connection
| 2008-01-30 13:38:51,456 TRACE [org.jboss.mq.il.uil2.SocketManager] Begin internalSendMessage, one-way msg=org.jboss.mq.il.uil2.msgs.ConnectionTokenMsg14492623[msgType: m_setSpyDistributedConnection, msgID: 2, error: null]
| 2008-01-30 13:38:51,456 TRACE [org.jboss.mq.il.uil2.SocketManager] Write msg: org.jboss.mq.il.uil2.msgs.ConnectionTokenMsg14492623[msgType: m_setSpyDistributedConnection, msgID: 2, error: null]
| 2008-01-30 13:38:51,456 TRACE [org.jboss.mq.il.uil2.SocketManager] End internalSendMessage, msg=org.jboss.mq.il.uil2.msgs.ConnectionTokenMsg14492623[msgType: m_setSpyDistributedConnection, msgID: 2, error: null]
| 2008-01-30 13:38:51,456 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] The UILClientIL Connection is set up
| 2008-01-30 13:38:51,456 TRACE [org.jboss.mq.il.uil2.ServerSocketManagerHandler] End handleMsg, msgType: 15
| 2008-01-30 13:38:51,464 TRACE [org.jboss.mq.il.uil2.SocketManager] Read msgType: m_getID, msgID: 3
| 2008-01-30 13:38:51,464 TRACE [org.jboss.mq.il.uil2.SocketManager] Read new msg: org.jboss.mq.il.uil2.msgs.GetIDMsg5907955[msgType: m_getID, msgID: 3, error: null]
| 2008-01-30 13:38:51,464 TRACE [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Begin handleMsg, msgType: 9
| 2008-01-30 13:38:51,464 TRACE [org.jboss.mq.server.TracingInterceptor] CALLED : getID
| 2008-01-30 13:38:51,465 TRACE [org.jboss.mq.sm.jdbc.JDBCStateManager] Client id 'ID:3' is logged in.
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.server.TracingInterceptor] RETURN : getID
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.il.uil2.SocketManager] Begin internalSendMessage, one-way msg=org.jboss.mq.il.uil2.msgs.GetIDMsg5907955[msgType: m_getID, msgID: 3, error: null]
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.il.uil2.SocketManager] Write msg: org.jboss.mq.il.uil2.msgs.GetIDMsg5907955[msgType: m_getID, msgID: 3, error: null]
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.il.uil2.SocketManager] End internalSendMessage, msg=org.jboss.mq.il.uil2.msgs.GetIDMsg5907955[msgType: m_getID, msgID: 3, error: null]
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.il.uil2.ServerSocketManagerHandler] End handleMsg, msgType: 9
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.il.uil2.SocketManager] Read msgType: m_ping, msgID: 4
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.il.uil2.SocketManager] Read new msg: org.jboss.mq.il.uil2.msgs.PingMsg15033128[msgType: m_ping, msgID: 4, error: null]
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Begin handleMsg, msgType: 21
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.server.TracingInterceptor] CALLED : ping
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.server.TracingInterceptor] ARG : 1201721931464
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.il.uil2.SocketManager] Begin internalSendMessage, one-way msg=org.jboss.mq.il.uil2.msgs.PingMsg30468875[msgType: m_pong, msgID: -2147483643, error: null]
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.il.uil2.SocketManager] Write msg: org.jboss.mq.il.uil2.msgs.PingMsg30468875[msgType: m_pong, msgID: -2147483643, error: null]
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.il.uil2.SocketManager] End internalSendMessage, msg=org.jboss.mq.il.uil2.msgs.PingMsg30468875[msgType: m_pong, msgID: -2147483643, error: null]
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.server.TracingInterceptor] RETURN : ping
| 2008-01-30 13:38:51,466 TRACE [org.jboss.mq.il.uil2.ServerSocketManagerHandler] End handleMsg, msgType: 21
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.il.uil2.SocketManager] Read msgType: m_transact, msgID: 5
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.il.uil2.SocketManager] Read new msg: org.jboss.mq.il.uil2.msgs.TransactMsg16199287[msgType: m_transact, msgID: 5, error: null]
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Begin handleMsg, msgType: 17
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.server.TracingInterceptor] CALLED : transact
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.server.TracingInterceptor] ARG : org.jboss.mq.TransactionRequest@bc7c0
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.server.JMSDestinationManager] ConnectionToken:ID:3/93cc4c88601c60075aa0dbc4d702f250 1PC null txId=3
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.pm.TxManager] Commit branch=3
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.server.TracingInterceptor] RETURN : transact
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.il.uil2.SocketManager] Begin internalSendMessage, one-way msg=org.jboss.mq.il.uil2.msgs.TransactMsg16199287[msgType: m_transact, msgID: 5, error: null]
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.il.uil2.SocketManager] Write msg: org.jboss.mq.il.uil2.msgs.TransactMsg16199287[msgType: m_transact, msgID: 5, error: null]
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.il.uil2.SocketManager] End internalSendMessage, msg=org.jboss.mq.il.uil2.msgs.TransactMsg16199287[msgType: m_transact, msgID: 5, error: null]
| 2008-01-30 13:38:51,500 TRACE [org.jboss.mq.il.uil2.ServerSocketManagerHandler] End handleMsg, msgType: 17
| 2008-01-30 13:38:51,502 TRACE [org.jboss.mq.il.uil2.SocketManager] Read msgType: m_connectionClosing, msgID: 6
| 2008-01-30 13:38:51,502 TRACE [org.jboss.mq.il.uil2.SocketManager] Read new msg: org.jboss.mq.il.uil2.msgs.CloseMsg23533966[msgType: m_connectionClosing, msgID: 6, error: null]
| 2008-01-30 13:38:51,502 TRACE [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Begin handleMsg, msgType: 5
| 2008-01-30 13:38:51,503 TRACE [org.jboss.mq.server.TracingInterceptor] CALLED : connectionClosing
| 2008-01-30 13:38:51,503 TRACE [org.jboss.mq.sm.jdbc.JDBCStateManager] Client id 'ID:3' is logged out.
| 2008-01-30 13:38:51,503 TRACE [org.jboss.mq.il.uil2.SocketManager] stop() Thread[UIL2.SocketManager.ReadTask#5 client=127.0.1.1:52621,5,JBossMQ Server Threads] Thread[UIL2.SocketManager.WriteTask#6 client=127.0.1.1:52621,5,JBossMQ Server Threads]
| 2008-01-30 13:38:51,503 TRACE [org.jboss.mq.il.uil2.SocketManager] WriteTask was interrupted
| java.lang.InterruptedException
| at java.lang.Object.wait(Native Method)
| at EDU.oswego.cs.dl.util.concurrent.LinkedQueue.poll(LinkedQueue.java:170)
| at org.jboss.mq.il.uil2.SocketManager$WriteTask.run(SocketManager.java:551)
| at java.lang.Thread.run(Thread.java:595)
| 2008-01-30 13:38:51,503 TRACE [org.jboss.mq.il.uil2.SocketManager] Exiting on IOE
| java.net.SocketException: Socket closed
| at java.net.SocketInputStream.read(SocketInputStream.java:162)
| at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
| at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
| at org.jboss.util.stream.NotifyingBufferedInputStream.read(NotifyingBufferedInputStream.java:79)
| at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2196)
| at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2376)
| at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2443)
| at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2515)
| at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2664)
| at java.io.ObjectInputStream.readByte(ObjectInputStream.java:875)
| at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:340)
| at java.lang.Thread.run(Thread.java:595)
| 2008-01-30 13:38:51,503 TRACE [org.jboss.mq.server.TracingInterceptor] RETURN : connectionClosing
| 2008-01-30 13:38:51,503 DEBUG [org.jboss.mq.il.uil2.ServerSocketManagerHandler] Exiting on IOE
| java.net.SocketException: Socket closed
| at java.net.SocketInputStream.read(SocketInputStream.java:162)
| at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
| at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
| at org.jboss.util.stream.NotifyingBufferedInputStream.read(NotifyingBufferedInputStream.java:79)
| at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2196)
| at java.io.ObjectInputStream$BlockDataInputStream.readBlockHeader(ObjectInputStream.java:2376)
| at java.io.ObjectInputStream$BlockDataInputStream.refill(ObjectInputStream.java:2443)
| at java.io.ObjectInputStream$BlockDataInputStream.read(ObjectInputStream.java:2515)
| at java.io.ObjectInputStream$BlockDataInputStream.readByte(ObjectInputStream.java:2664)
| at java.io.ObjectInputStream.readByte(ObjectInputStream.java:875)
| at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:340)
| at java.lang.Thread.run(Thread.java:595)
| 2008-01-30 13:38:51,503 TRACE [org.jboss.mq.il.uil2.SocketManager] Failed to handle: org.jboss.mq.il.uil2.msgs.CloseMsg23533966[msgType: m_connectionClosing, msgID: 6, error: null]
| java.io.IOException: Client is not connected
| at org.jboss.mq.il.uil2.SocketManager.internalSendMessage(SocketManager.java:288)
| at org.jboss.mq.il.uil2.SocketManager.sendReply(SocketManager.java:262)
| at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:134)
| at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:419)
| at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:398)
| at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:761)
| at java.lang.Thread.run(Thread.java:595)
| 2008-01-30 13:38:51,503 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run Thread[UIL2.SocketManager.ReadTask#5 client=127.0.1.1:52621,5,JBossMQ Server Threads]
| 2008-01-30 13:38:51,503 TRACE [org.jboss.mq.il.uil2.SocketManager] Failed to send error reply
| java.io.IOException: Client is not connected
| at org.jboss.mq.il.uil2.SocketManager.internalSendMessage(SocketManager.java:288)
| at org.jboss.mq.il.uil2.SocketManager.access$900(SocketManager.java:53)
| at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:432)
| at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:398)
| at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:761)
| at java.lang.Thread.run(Thread.java:595)
| 2008-01-30 13:38:51,503 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run Thread[UIL2.SocketManager.WriteTask#6 client=127.0.1.1:52621,5,JBossMQ Server Threads]
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124917#4124917
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124917
18 years, 2 months
[Security & JAAS/JBoss] - Re: Logout from a WebService application
by KerryJordan
I have a similar problem. I am developing a Adobe Flex application that sends commands to a secure (via JAAS basic authentication) JBoss Java servlet. My version of JBoss is 4.2.2.GA. When a logout command is sent by the client application, I attempt to invalidate the session by calling the getSession() method on the HttpServletRequest object and then calling the invalidate() method on the returned session. However, this does not call the logout method of my custom login module (which extends the AbtractServerLoginModule), remove the principal from the JBoss JaasSecurityManager cache, nor apparently cause the authentication cache of Internet Explorer to clear. I'm not certain it even works at all. My jboss-web.xml in the application .ear contains the following:
| <?xml version="1.0" encoding="UTF-8"?>
| <jboss-web>
| <security-domain flushOnSessionInvalidation="true">java:/jaas/MyRealm</security-domain>
| </jboss-web>
|
which as I understand it, should cause the logout to occur on session invalidation.
I did add the following code to clear the JaasSecurityManager cache programatically (which calls my logout method), but that still leaves the cache on Internet Explorer intact (and I suspect that the session has not truly been invalidated)...
| String domain = "MyRealm";
| Principal user = req.getUserPrincipal(); // req is HttpServletRequest
| ObjectName jaasMgr = new ObjectName( "jboss.security:service=JaasSecurityManager" );
| Object[] params = { domain, user };
| String[] signature = { "java.lang.String", Principal.class.getName() };
| MBeanServer server = ( MBeanServer ) MBeanServerFactory.findMBeanServer( null ).get( 0 );
| server.invoke( jaasMgr, "flushAuthenticationCache", params, signature );
|
Any thoughts or suggestions? I could really use some expert advice...
Kerry
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4124913#4124913
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4124913
18 years, 2 months