Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /* ZkAuthenticationEntryPoint.java
 
 {{IS_NOTE
 	Purpose:
 		
 	Description:
 		
 	History:
 		Thu Dec 21 16:17:28     2006, Created by Henri
}}IS_NOTE
Copyright (C) 2006 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
}}IS_RIGHT
*/
package org.zkoss.zkplus.acegi;
import  org.zkoss.zul.Textbox;
import  org.zkoss.zul.Window;
import  org.acegisecurity.AuthenticationException;
import  org.acegisecurity.providers.UsernamePasswordAuthenticationToken;
import  org.acegisecurity.ui.webapp.AuthenticationProcessingFilter;
import  org.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint;
import  org.acegisecurity.context.SecurityContextHolder;
import  org.springframework.beans.factory.InitializingBean;
import  org.springframework.util.Assert;
import  javax.servlet.http.HttpServletRequestWrapper;
import  javax.servlet.RequestDispatcher;
import  javax.servlet.ServletException;
import  javax.servlet.ServletRequest;
import  javax.servlet.ServletResponse;
import  javax.servlet.http.HttpServletRequest;
import  javax.servlet.http.HttpServletResponse;

This implementation would forward to onAcegiLogin event and popup a login page.

Author(s):
Henri
See also:
ZkAuthenticationProcessingFilter
ShowWindowEventListener
public class ZkAuthenticationEntryPoint extends AuthenticationProcessingFilterEntryPoint {
	/*package*/ static final String ON_ACEGILOGIN = "onAcegiLogin";
    

This implmentation forward request to onAcegiLogin command.

	public void commence(ServletRequest request, ServletResponse response, AuthenticationException authException)
    throws IOException, ServletException {
    	final Component comp = (Componentrequest.getAttribute(.);
    	
    	//remember the original event that cause the security login in session
    	final Event evt = (Eventrequest.getAttribute(.);
		((HttpServletRequest)request).getSession().setAttribute(.evt);					
		if (!comp.isListenerAvailable(true)) {
			final EventListener listener = new ShowWindowEventListener();
			comp.setAttribute(listener);
		}
		final String url = getLoginFormUrl();
    	Events.postEvent(new Event(compurl != null ? url : "~./acegilogin.zul"));
    }
New to GrepCode? Check out our FAQ X