Hi,
you're right it
I had now another way, but without still no possibility of redirection.
I had an own WorkpageDispatchedPageBean class where I check if a page should be secure or not. I mark my not secure pages e.g. Around and Logon page with an Unsercure annotation.
In the constructor I do following check:
Code:
public WorkpageDispatchedPageBean(IWorkpageDispatcher dispatcher) {
super(dispatcher);
Annotation unsecure = this.getClass().getAnnotation(Unsecure.class);
if(unsecure == null) checkAuthorization();
}
Code:
private void checkAuthorization() {
// return if viewed in editor
if(HttpSessionAccess.checkIfInLayoutEditorPreview()) return;
// check user
String user = UserAccessMgr.getCurrentUser();
if(StringUtils.isEmpty(user) || UserAccess.USER_UNDEFINED.equals(user)) {
try {
HttpSessionAccess.getCurrentResponse().sendError(403);
} catch (IOException e) {
FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
}
}
}
I just send a 403 (Forbidden) HTTP Status to the client. If an error occures I invalidate the session just to be sure that no access is possible in cause of problem with IOException.
The annotation class:
Code:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Unsecure {
}
I think there should be a possibility in CC so that a redirect work?
Code:
FacesContext.getCurrentInstance().getExternalContext().redirect(arg0)
regard
Markus