-
1. Re: Elegant solution for "already logged in" user
lucaster Apr 9, 2013 6:57 AM (in response to itays100)2. login-required="true": When clicking on the link I am being forwad to the login page which is incorreect (I'm already logged in)
Maybe you are logged in in a browser window and when you click in the Excel link, another browser window is opened?
-
2. Re: Elegant solution for "already logged in" user
itays Apr 14, 2013 10:02 AM (in response to lucaster)of course. new window is normal. (new tab, to be precise) . When you are logged in, you have a session so each window (tab) is using the same session.
The new window is opened with the same session (I can see the user details in the header) but the login page is shown anyway.
This is happened only when you link from anywhere which is not a browser. (Excel is my private case) I thought I made myself clear in my first post though. ;-)
That's a realy generic scenario that you expect seam will have a good solution/design for this.
-
3. Re: Elegant solution for "already logged in" user
itays100 May 19, 2013 9:35 AM (in response to itays100)Just for everyone with the same problem here is the solution that worked for me:
My pages.xml looks like this now:
<page view-id="/mypage.xhtml" login-required="true">
<begin-conversation join="true" />
<param name="myid" value="#{sampleComponent.myid)}"/>
<action execute="#{sampleComponent.linkToObjectPage(myid)}" if="#{myid != null}"/>
<rewrite pattern="/mypage"/></page>
I uses request parameter annotation inside the seam component:
@Name("sampleComponent")
@Scope(ScopeType.CONVERSATION)
public class SampleComponent
{
@RequestParameter("myId")
public String myId;
public String getMyId() {
return myId;
}
public void setMyId(String myId) {
this.myId = myId;
}
Added specific rule to the login page:
<rule if="#{identity.loggedIn and identity.hasRole('someRole') and myId != null}">
<redirect view-id="/myPage.xhtml"/>
</rule>
Hope this help for anyone with the same issue.