1 Reply Latest reply: Jul 18, 2012 6:24 PM by zeeman RSS

redirect user if already logged in

kelly goedert Apprentice

Hi,

 

I am using seam 3 security and I want to bypass the login page if the user is already logged in. I tried to put this in faces-config.xml but it did not work

 

<navigation-rule>
                    <from-view-id>*</from-view-id>
                    <navigation-case>
                              <from-action>#{identity.login}</from-action>
                              <if>#{identity.loggedIn}</if>
                              <to-view-id>/user/search.xhtml</to-view-id>
                              <redirect>
                                        <view-param>
                                                  <name>cid</name>
                                                  <value>#{userBean.conversation.id}</value>
                                        </view-param>
                              </redirect>
                    </navigation-case>
                    <navigation-case>
                              <from-action>#{identity.login}</from-action>
                              <from-outcome>failed</from-outcome>
                              <to-view-id>/denied.xhtml</to-view-id>
                    </navigation-case>
                    <navigation-case>
                              <from-outcome>login</from-outcome>
                              <to-view-id>/login.xhtml</to-view-id>
                              <redirect />
                    </navigation-case>
                    <navigation-case>
                              <if>#{identity.loggedIn}</if>
                              <to-view-id>/user/search.xhtml</to-view-id>
                              <redirect>
                                        <view-param>
                                                  <name>cid</name>
                                                  <value>#{userBean.conversation.id}</value>
                                        </view-param>
                              </redirect>
                    </navigation-case>
          </navigation-rule>

 

 

What I want is: if the user is not logged in, he should be redirected to the login page, if he is already logged in, he should be redirected to another page, bypassing the login.

 

Thanks for any help

 

Kelly