문제

I am developing a site with Seam 3 and JBoss 7. I'm using Seam security and JSF. The front page of the site has the login controls. When the user enters his credentials he is redirected to his user page "/MySC".

But if the logged-in user just types the domain root "/" he gets to the front page. What I want is that when the user is logged-in, he should not be able to access the front page again. If he requests to go to the front page or enter the domain root in the location bar, I want him to be redirected to "/MySC". How can I do that?

도움이 되었습니까?

해결책

You can use SEAM navigation rule which is quite powerful.. You declare it in page.xml... You can declare conditional navigation rule there..

<page view id="/view.xhtml">
      <navigation from-action="#{user.login}">
           <rule if-outcome="successfull"><redirect view-id="/MySC.xhtml"/>
           <message severity="Info">
                Your login is successfull!.
           </message>
      </navigation>
</page>

다른 팁

I recommend a small redesign the page structure: Make the front page /start the page that an authenticated user is allowed to see, and redirect to /login if the user is not authenticated yet.

This design is not only cleaner in terms of separation of concerns (allows you to bundle the authentication logic in a distinct folder), it also solves the problem of mixing context root and authentication page.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top