org.zkoss.spring.security.ui
Class ZkExceptionTranslationListener

java.lang.Object
  extended by org.zkoss.spring.security.ui.ZkExceptionTranslationListener
All Implemented Interfaces:
org.zkoss.zk.ui.event.EventThreadCleanup

public class ZkExceptionTranslationListener
extends java.lang.Object
implements org.zkoss.zk.ui.event.EventThreadCleanup

Bridge AuthenticationException thrown inside ZK event processing phase to Spring Security system and make AuthenticationEntryPoint and AccessDeniedHandler Ajaxified.

This is generally used with one-page application that users need to login half way. Basically, this implementation pops up a highlighted login window and embeds the original Spring Security login form inside the window so the login process still go through the original Spring Security filters; make it virtually the same as login on another browser window (but with the same session).

Note this listener handles AuthenticationException thrown inside ZK event processing phase only; so it would mainly handle the protected Method invocation. ZK also supports protecting event as well. You can configure to protect specific events and components. Please see ZkEventProcessInterceptor for details.

As said, this listener will use a customized zkExceptionTranslationFilter to do authentication or access denied handling. You can specify the zkExceptionTranslationFilter in either ways:

  1. Define a Spring bean extends from org.springframework.security.ui.ExceptionTranslationFilter or use the default implemented ZkExceptionTranslationFilter and configure it to your needs
  2. Or, if the Spring bean is not defined, this implementation will new a ZkExceptionTranslationFilter automatically and use default configuration.

To enable this listener, just specify the following in WEB-INF/zk.xml


        <listener>
                <description>ZK Exception Translation Listener</description>
                <listener-class>org.zkoss.spring.ZkExceptionTranslationListener</listener-class>
        </listener>
 

Since:
1.0
Author:
henrichen
See Also:
ZkExceptionTranslationFilter, ZkAuthenticationEntryPoint, ZkAccessDeniedHandler

Field Summary
static java.lang.String ZK_EXCEPTION_TRANSLATION
           
 
Constructor Summary
ZkExceptionTranslationListener()
           
 
Method Summary
 void cleanup(org.zkoss.zk.ui.Component comp, org.zkoss.zk.ui.event.Event evt, java.util.List errs)
           
 void complete(org.zkoss.zk.ui.Component comp, org.zkoss.zk.ui.event.Event evt)
           
 void doExceptionTranslationFiltering(java.lang.Throwable ex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZK_EXCEPTION_TRANSLATION

public static final java.lang.String ZK_EXCEPTION_TRANSLATION
See Also:
Constant Field Values
Constructor Detail

ZkExceptionTranslationListener

public ZkExceptionTranslationListener()
Method Detail

cleanup

public void cleanup(org.zkoss.zk.ui.Component comp,
                    org.zkoss.zk.ui.event.Event evt,
                    java.util.List errs)
             throws java.lang.Exception
Specified by:
cleanup in interface org.zkoss.zk.ui.event.EventThreadCleanup
Throws:
java.lang.Exception

complete

public void complete(org.zkoss.zk.ui.Component comp,
                     org.zkoss.zk.ui.event.Event evt)
              throws java.lang.Exception
Specified by:
complete in interface org.zkoss.zk.ui.event.EventThreadCleanup
Throws:
java.lang.Exception

doExceptionTranslationFiltering

public void doExceptionTranslationFiltering(java.lang.Throwable ex)
                                     throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.