Actually it's not possible. I think we could send some context/error reason from JAAS login through session attribute and read it from LoginServlet/login.jsp and display the actual reason. Could you create JIRA in https://issues.jboss.org/browse/GTNPORTAL ?
I guess that you want to display custom message if user is already logged in different session. To achieve it, you will need to:
- Create subclass of JBossLoginModule (or TomcatLoginModule) and override method "commit()" which will set some error flag as attribute into Http session in case that singleLogin=true and user is already logged in IdentityRegistry . You can look at existing login modules (SSOLoginModule, OAuthLoginModule) if you want to know how to obtain HTTP Session. Another alternative is to use ThreadLocal instead of HTTP Session, which should work during Servlet 3.0 login via HTTP.
- In login.jsp, you will need to read content of the attribute from HTTP session and if flag is here, you know that login failed because user is already logged in different session.