Hi guys

I'm using T5.3.2 with tapestry-spring-security 3.0.3

I want to do some custom redirecting when a user logs in, so I tried
several ways to override the UsernamePasswordAuthenticationFilter of
tapestry-spring-security, but all failed.

The build Method looks like this:

public RoleBasedAuthenticationFilter buildRoleBasedAuthenticationFilter(
            final AuthenticationManager manager,
            final RememberMeServices rememberMeServices,
            RoleBasedAuthenticationSuccessHandler successHandler,
            Logger logger,
            @Inject @Value( "${spring-security.check.url}" ) final
String authUrl,
            @Inject @Value( "${spring-security.target.url}" ) final
String targetUrl,
            @Inject @Value( "${spring-security.failure.url}" ) final
String failureUrl,
            @Inject @Value( "${spring-security.always.use.target.url}"
) final String alwaysUseTargetUrl ) throws Exception {

        logger.debug("MMANAGER IS : " + manager);

        RoleBasedAuthenticationFilter filter = new
RoleBasedAuthenticationFilter(logger);
        // do the same configuration like in the original SecurityModule
        return filter;
}


The existing examples I found in the mailing list are all for T5.1,
where AliasContribution still existed... does ServiceOverride work
differently? I couldn't get them to work either.

When I make my own build method and want to contribute the instance to
ServiceOverride, I get an exception due to recursion.

Adding it to the ServiceOverride as class lets me start the app, but
the Filter seems to not being set up correctly (it throws exceptions
because of the AuthenticationManager being NULL):
      configuration.addInstance(UsernamePasswordAuthenticationFilter.class,
RoleBasedAuthenticationFilter.class);

I also tried the lazy method with a proxy from ObjectLocator in the
ServiceOverride, but that fails because
UsernamePasswordAuthenticationFilter is not an interface.


Then I tried to do the configuration by using a decorator method, but
that one was never called (I tried serveral naming combinations like
class name, ID, annotations)
public static UsernamePasswordAuthenticationFilter
decorateRealUsernamePasswordAuthenticationFilter(
            @InjectService("RealAuthenticationProcessingFilter")
            UsernamePasswordAuthenticationFilter baseService,
            RoleBasedAuthenticationSuccessHandler successHandler){

        baseService.setAuthenticationSuccessHandler(successHandler);
        return baseService;
}



My simple (but big) question is: How can I override that service? Is
there a sample which works under T5.3.2?


Cheers and thanks in advance
Beat

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

Reply via email to