javaservletsjbossjboss7.xgatein

Get current user on GateIn 3.3/Jboss AS 7 from AJAX


I wanna get current user from AJAX query. For this obvious I have to use the code:

String user = request.getRemoteUser();

but I have null value for authenticated portal user.

I googled it a much and found this article: https://community.jboss.org/wiki/GWTGadgetAccessingPortalServices/version/2 where the author describes how to resolve this issue. But the article contains information about enabling SSO for jboss6.x, here it is:

Uncomment the single sign on authenticator valve: for JBoss located in server/default/deploy/jbossweb.sar/server.xml

Official GateIn documentations also describes SSO for JBoss 6.x and older.

How I can do the same in JBoss AS 7?


Solution

  • I've enabled SSO by adding <sso reauthenticate="false"/> to the subsystem configuration:

        <subsystem xmlns="urn:jboss:domain:web:1.1" native="false" default-virtual-server="default-host">
            <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
            <virtual-server name="default-host" enable-welcome-root="true">
                <alias name="localhost"/>
                <alias name="example.com"/>
                <sso reauthenticate="false"/>
            </virtual-server>
        </subsystem>
    

    Getting current user is working for me now.