Hi,

its Tapestry 4.0.2. We use ACEGI for the authentication. Below is how its
configured in

/***** hivemodule.xml *****
***********************/

        
        <service-point id="FormProcessingFilter"
interface="web.filters.FormProcessor">
        <invoke-factory>
            <construct class="web.filters.FormProcessingFilter"
initialize-method="afterPropertiesSet">
                <set property="authenticationFailureUrl" value="/HomePage.html"
/>
                <set property="defaultTargetUrl"
value="/LoginRedirectDispatcher.html" />
                <set property="filterProcessesUrl"
value="/j_acegi_security_check" />
                <set property="continueChainBeforeSuccessfulAuthentication"
value="false" />
            </construct>
        </invoke-factory>
    </service-point>
    
    <service-point id="FormAuthenticationEntryPoint"
interface="org.acegisecurity.ui.AuthenticationEntryPoint">
        <invoke-factory>
            <construct class="web.filters.FormAuthenticationEntryPoint">
                <set property="loginFormUrl" value="/HomeDispatcher.html" />
                <set property="forceHttps" value="false" />
            </construct>
        </invoke-factory>
    </service-point>



/***** FormProcessingFilter.java *****
******************************/
public class FormProcessingFilter extends AuthenticationProcessingFilter
implements FormProcessor  {
........
........

        public boolean attemptAuthentication( String username, String password 
) {
                UsernamePasswordAuthenticationToken authRequest = new
UsernamePasswordAuthenticationToken( username, password );
                authRequest.setDetails( 
authenticationDetailsSource.buildDetails( request
) );
                
                Authentication authResult;
                
                try {   
                        authResult = getAuthenticationManager().authenticate( 
authRequest );                    
                } catch( AuthenticationException failed ) {
                        failed.printStackTrace();
                        SecurityContextHolder.getContext().setAuthentication( 
null );
                        return false;
                }
                
                try {                   
                        successfulAuthentication( request, response, authResult 
);
                } catch( IOException e ) {
                        log.error("--(authentication )IOException--: " + 
e.getMessage() );
                        return false;
                }
                
                return true;
        }
        
        @Override
    protected void onSuccessfulAuthentication(HttpServletRequest request,
HttpServletResponse response,Authentication authResult) throws IOException{

//          System.out.println("in successfull authentation
method.........");
          GrantedAuthority[] authArray = authResult.getAuthorities();
          for (int i = 0; i < authArray.length; i++) {
//                System.out.println("The Role "+ i+" = " +authArray[i] + "
: " + authResult.getName());
          }
          HttpSession session = request.getSession();
          SecurityContext sc = SecurityContextHolder.getContext();
          sc.setAuthentication(authResult);
          session.setAttribute("ACEGI_SECURITY_CONTEXT", sc);
    }




/***** FormProcessingFilter.java *****
******************************/
public class FormAuthenticationEntryPoint extends
AuthenticationProcessingFilterEntryPoint {
        public void commence(ServletRequest request, ServletResponse response,
                        AuthenticationException authException) throws 
IOException,
ServletException {
                ((HttpServletResponse) response).addHeader("Connection", 
"close");
                super.commence(request, response, authException);
        }
}


Thanks,
Sunil


--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Tapestry-Remembers-which-page-to-navigate-after-User-Logs-in-tp4489125p4489354.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to