-
1. Re: Redirect to error-page for AuthorizationException with @
gavin.king Mar 1, 2007 11:22 AM (in response to hamtho2)Yes, use a seam exception handler defined in pages.xml. This is in the seamspace example i believe.
-
2. Re: Redirect to error-page for AuthorizationException with @
hamtho2 Mar 1, 2007 11:33 AM (in response to hamtho2)okay - I will have a look.
BTW: Is there any way to include the role through a static variable from an interface, so that you can replace
@Restrict("#{s:hasRole(''admin)}")
with anything like this
@Restrict("#{s:hasRole(SecurityRoles.ADMIN)}") ? -
3. Re: Redirect to error-page for AuthorizationException with @
hamtho2 Mar 1, 2007 12:23 PM (in response to hamtho2)sorry, but I did it the same way like in the examples. But it´s still the same. It works if the restriction comes through the pages.xml but not if it comes through the backing-bean.
Any further suggestions?
Thomas -
4. Re: Redirect to error-page for AuthorizationException with @
gavin.king Mar 1, 2007 12:26 PM (in response to hamtho2)Do you have the SeamFilter installed in web.xml?
-
5. Re: Redirect to error-page for AuthorizationException with @
hamtho2 Mar 1, 2007 12:37 PM (in response to hamtho2)I did it this way:
<filter> <filter-name>Seam Filter</filter-name> <filter-class>org.jboss.seam.web.SeamFilter</filter-class> </filter> <filter-mapping> <filter-name>Seam Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
-
6. Re: Redirect to error-page for AuthorizationException with @
hamtho2 Mar 1, 2007 12:37 PM (in response to hamtho2)If it´s of any importance: I´m using trinidad as well, but this shouldn´t be a problem, should it?
-
7. Re: Redirect to error-page for AuthorizationException with @
tazman Mar 5, 2007 5:17 PM (in response to hamtho2)I have also a similar problem with login redirection.
If I set login-required to true for a page in pages.xml, everything works as expected. However, when I programmatically throw NotLoggedInException I get the debug page:if (!Identity.instance().isLoggedIn()) throw new NotLoggedInException();
tazman -
8. Re: Redirect to error-page for AuthorizationException with @
lisaanm Mar 15, 2007 6:10 AM (in response to hamtho2)Hi.,
I have the same question. If I programmatically throw NotLoggedInException, then the page is not redirected to the other page that is defined as below in pages.xml file<exception class="org.jboss.seam.security.NotLoggedInException"> <redirect view-id="/login.xhtml"> <message> You must be logged in to perform this action </message> </redirect> </exception>
If anyone sucessfully integrated throw-exception-redirect, please share your comments.
Thanks -
9. Re: Redirect to error-page for AuthorizationException with @
hamtho2 Mar 17, 2007 11:27 AM (in response to hamtho2)As a lot of people still have the same problems, would this be something to file in JIRA?
-
10. Re: Redirect to error-page for AuthorizationException with @
gavin.king Mar 17, 2007 12:16 PM (in response to hamtho2)Negative. This works beautifully in me. Use your debuggers and follow the examples!
-
11. Re: Redirect to error-page for AuthorizationException with @
gavin.king Mar 17, 2007 12:19 PM (in response to hamtho2)To repeat:
Generate an app using seam-gen. Generate an action. Add @Restrict("#{identity.loggedIn}") to the action method. Watch what happens.
Now fix your code to look like seam-gen. -
12. Re: Redirect to error-page for AuthorizationException with @
fhh Mar 17, 2007 9:57 PM (in response to hamtho2)I can confirm this. @Restrict("#{identity.loggedIn}") on action methods also works for me.
However, I have not tried to throw an action method programmatically whithin that methhod.
Regards
Felix -
13. Re: Redirect to error-page for AuthorizationException with @
markfoerstein Apr 11, 2007 11:44 AM (in response to hamtho2)Im facing a similar problem.
When an AuthorizationException raises:
Using @Restrict at the class level gives me the default error page.@Name("sphconsullanEditor") @Stateful @Restrict public class SphConsullanEditorBean implements SphConsullanEditor { ...
Using @Restrict at the method level, redirection works fine.@Restrict public String create() { ...
It is just a matter of moving the @Restrict annotation from one place to another, so clearly everything else is configured correctly. Also, all other redirections on pages.xml work fine, like login-required, no-conversation, NotLoggedInException, etc.
Thoughts? ;-) -
14. Re: Redirect to error-page for AuthorizationException with @
markfoerstein Apr 11, 2007 11:55 AM (in response to hamtho2)Forgot to say... Im using version 1.2.1GA.