-
1. Re: How to make ViewConfig work
lightguard Feb 14, 2012 9:25 PM (in response to jf321023)Set the checks to be done in the RESTORE_VIEW phase.
-
2. Re: How to make ViewConfig work
jf321023 Feb 14, 2012 10:29 PM (in response to lightguard)Hi Jason,
I tried your solution,but seems does not work .
I changed the @ViewConfig annotationed interface and added the @RestrictAtPhase(PhaseIdType.RESTORE_VIEW) in the enum.
@ViewConfig
public interface Pages {
static enum page {
@ViewPattern("/*")
@LoginView("/login.xhtml")
@AccessDeniedView("/item/list.xhtml")
ALL,
@RestrictAtPhase(PhaseIdType.RESTORE_VIEW)
@ViewPattern("/pages/*")
@LoginView("/login.xhtml")
@User
User;
}
}
The authorization method also invoked, whether true or false in returned, access also was granted.
public @Secures @User boolean userChecker(Identity identity) {
System.out.println(FacesContext.getCurrentInstance().getCurrentPhaseId());
if (identity.getUser() == null) {
return false;
} else {
return true;
}
}
-
3. Re: How to make ViewConfig work
lightguard Feb 14, 2012 10:32 PM (in response to jf321023)This is odd, there may have been a fix for this since 3.1.0.Final, but I thought that at least worked.
-
4. Re: How to make ViewConfig work
jf321023 Feb 14, 2012 10:58 PM (in response to lightguard)I also find it very strange and helpless. I hope there are some examples or some other way to achieve this.
-
5. Re: How to make ViewConfig work
clerum Feb 14, 2012 11:00 PM (in response to jf321023)I've had success with
@RestrictAtPhase({PhaseIdType.RESTORE_VIEW, PhaseIdType.INVOKE_APPLICATION})
-
6. Re: How to make ViewConfig work
jf321023 Feb 14, 2012 11:18 PM (in response to clerum)Let me try ~~
-
7. Re: How to make ViewConfig work
jf321023 Feb 14, 2012 11:25 PM (in response to clerum)Oh no , i was hurt !!! why my ViewConfig does not work? The authorization method invoked, and it return , but whether ture or false, request always be granted.
-
8. Re: How to make ViewConfig work
jf321023 Feb 15, 2012 12:45 AM (in response to jf321023)1 of 1 people found this helpfulI made a mistake . My login page is not named login.xthml but Login.xhtml...
If your @LoginView page is not exist , and then the request will be granted. No matter the authorization method returned what or user whether logged in with @LoggIn .
I think it is not reasonable .
Thank Jason and Cody for answer my question .
-
9. Re: How to make ViewConfig work
blabno Feb 15, 2012 1:48 AM (in response to jf321023)Well, this qualifies for JIRA then.
-
10. Re: How to make ViewConfig work
lightguard Feb 15, 2012 4:59 PM (in response to blabno)A pull request would be better
Seems like a good way to get involved, probably not that difficult of an issue.