can not forward to different paths based on roles when using java authentication

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

can not forward to different paths based on roles when using java authentication

arindamk
Greetings to all,
I have been using orbeon forms war distribution version 3.9.
I am trying to use tomcat realm based login authentication using java authentication example
included in the bundle. Database is mysql and simple login authentication works when using the
bundled demonstration. However when using multiple roles based authentication I am not sure
how to proceed with forwarding the user to different views (i.e, formbuilder or formrunner) upon login.

What I have tried is the following configuration ....

in web.xml of the orbeon directory .. I add this piece of code :

        <security-constraint>
        <web-resource-collection>
            <web-resource-name>Orbeon Builder</web-resource-name>
           <url-pattern>/fr/orbeon/builder/*</url-pattern> 
         
        </web-resource-collection>
        <auth-constraint>
            <role-name>orbeon-admin</role-name> 
        </auth-constraint>
    </security-constraint>
    <login-config>
        <auth-method>FORM</auth-method>
        <form-login-config>
            <form-welcome-page>/Demo/welcome</form-welcome-page>
            <form-login-page>/Demo/login</form-login-page>
            <form-error-page>/Demo/login-error</form-error-page>
        </form-login-config>
    </login-config>
    <security-role>
        <role-name>orbeon-admin</role-name> 
    </security-role>


-----------------------------------------------------------------------------------------------


in 'page-flow.xml' under the 'resources' folder I add this


<config xmlns="http://www.orbeon.com/oxf/controller"
        xmlns:oxf="http://www.orbeon.com/oxf/processors">


                .........

   
    <page id="root" path-info="/(welcome/?)?" matcher="oxf:perl5-matcher">
        <action><result page="home"/></action>
    </page>

   
   

    <page id="home" path-info="/home/" model="apps/Demo/page-flow.xml"/>

       ..........
</config>


-------------------------------------------------------------------------------------------------


in properties-local.xml under the 'resource/config' folder I add


<properties xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:oxf="http://www.orbeon.com/oxf/processors">


     ....................

    <property as="xs:string" name="oxf.fr.authentication.method" value="container"/>
    <property as="xs:string" name="oxf.fr.authentication.container.roles" value="orbeon-admin orbeon"/> 
 

</properties>


------------------------------------------------------------------------------------------

I have made changes also in 'form-builder-permissions.xml' and 'form-runner-roles.xml'

<roles>

   

    <role name="*" app="*" form="*"/> 
   
   

</roles>

-----------------------------------------------------------------------------------------------------


I create the view-demo.xhtml for loading the first page

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xforms="http://www.w3.org/2002/xforms"
      xmlns:xi="http://www.w3.org/2001/XInclude">
    <head>
        <title>Demo Apps</title>
   
    </head>
    <body>
       
        <xforms:group ref=".[remote-user]">
           
           
        <p>
            Welcome user. Please Log in.
        </p>

        </xforms:group>
        <xforms:group ref=".[not(remote-user)]">
            <p>
                You are not logged in. This probably means that you have not yet configured the authentication in your
                application server. Please read the documentation
                for more information.
            </p>
        </xforms:group>
    </body>
</html>


in page-flow.xml under my apps folder I add

... ...

<page id="home" path-info="/home/" view="demo-view.xhtml"/>

    <page path-info="/Demo/welcome" view="demo-view.xhtml"/>
    <page path-info="/Demo/login" view="login.xhtml"/>
    <page path-info="/Demo/login-error" view="login-error.xhtml"/>
    <page path-info="/Demo/logout">
        <action action="logout.xpl">
       
                <result page="home"/>
        </action>
    </page>

......

--------------------------------------------------------------------------------------------------



If I want to access the path mentioned in web.xml file the link is redirect to my apps login page but the url is remain same. and after the authentication the control is going the url path "/fr/orbeon/builder/summary" . Its ok. BUt if I want to forward to another path e.g.  "/fr/orbeon/builder/new" or something else depending on user roles it shows ERROR: Please Suggest me what should I do.

Is there other way to achieve this . Can I use "submission:redirect". Please HELP me out ASAP....

Regards

Arindam