Not sure to really understand what your problem is , but have you tried
service override?

On Thu, May 6, 2010 at 11:02 AM, Nicolas Bouillon <nico...@bouil.org> wrote:

> Hi,
>
> I got a problem using tapestry-spring-security (
> http://www.localhost.nu/java/tapestry-spring-security/ )
>
> I have to override the SaltSourceService because my password database
> doesn't use any Salt.
>
> I have added this code to my AppModule :
>
>    public static void contributeAlias(
>            Configuration<AliasContribution<?>> configuration) {
>        configuration.add(AliasContribution.create(PasswordEncoder.class,
>                new Md5PasswordEncoder()));
>        configuration.add(AliasContribution.create(SaltSourceService.class,
>                new SaltSourceService() {
>                    public Object getSalt(UserDetails user) {
>                        return "";
>                    }
>                }));
>    }
>
>
> The SaltSourceService seems to be set this way in the SecurityModule class
> from tapestry-spring-security :
>
>    public static void contributeAlias(
>            @SpringSecurityServices SaltSourceService saltSource,
>            @SpringSecurityServices
> UsernamePasswordAuthenticationProcessingFilter
> authenticationProcessingFilter,
>            Configuration<AliasContribution<?>> configuration ) {
>
>        configuration.add( AliasContribution.create(
> SaltSourceService.class, saltSource ) );
>        configuration.add( AliasContribution.create(
>                UsernamePasswordAuthenticationProcessingFilter.class,
>                authenticationProcessingFilter ) );
>    }
>
>    @Marker( SpringSecurityServices.class )
>    public static SaltSourceService buildSaltSource(
>            @Inject @Value( "${spring-security.password.salt}" ) final
> String salt ) throws Exception {
>
>        SaltSourceImpl saltSource = new SaltSourceImpl();
>        saltSource.setSystemWideSalt( salt );
>        saltSource.afterPropertiesSet();
>        return saltSource;
>    }
>
>
> The problem is, from one run to another, the initialisation order is maybe
> different, and then my SaltSourceService is not used because my AppModule
> alias conflics withe the existing one :
>
> org.apache.tapestry5.services.TapestryModule.Alias - Contribution
> tapestry.services.appmodul...@fb0c124 (for type
> nu.localhost.tapestry5.springsecurity.services.SaltSourceService) conflicts
> with existing contribution <Proxy for
>
> SaltSource(nu.localhost.tapestry5.springsecurity.services.SaltSourceService)>
> and has been ignored.
>
> But if i stop and run again, it may work because my alias is maybuild built
> first :
>
> org.apache.tapestry5.services.TapestryModule.Alias - Contribution <Proxy
> for
>
> SaltSource(nu.localhost.tapestry5.springsecurity.services.SaltSourceService)>
> (for type nu.localhost.tapestry5.springsecurity.services.SaltSourceService)
> conflicts with existing contribution tapestry.services.appmodul...@7333fb54
> and has been ignored.
>
> Is there any possiblity to force Tapestry to use my version of the service
> ?
>
> Thanks.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to