Search code examples
javajakarta-eejbossseam

Different WAR files, shared same user permission


I have in a EAR two different .WAR files(A.war and B.war). The EAR file is deployed in an JBOSS server 4.0.5

Currently I have defined in A.WAR several user with their own permissions. In A.war the user is able to navigate to some screen that are stored in B.WAR( some JSF screen from B are embedded in A ) . The problem that I have is I need to check in B.WAR the current user and their permissions. All this data is assigned in A.war.

How can I say to B what is the user than is accessing?

How is possible to share the user permission between WAR files? It is possible?


Solution

  • You can enable SSO, as detailed here: JBoss7 Web SSO (Non-Clustered) or here: http://www.mastertheboss.com/jboss-server/jboss-security/configuring-single-signon-on-jboss-as-7

    Add sso tag to your standalone.xml:

    <virtual-server name="default-host" enable-welcome-root="false">
        ...
        <sso domain="local" reauthenticate="false"/>
    </virtual-server>
    

    And add/update your war/WEB-INF/jboss-web.xml:

    <jboss-web>
        <security-domain>sso</security-domain>
        <valve>
            <class-name>org.apache.catalina.authenticator.SingleSignOn</class-name>
        </valve>
    </jboss-web>