Re: [T5.1] tapestry-spring-security : overriding saltsource probleme
So finally it's fine! I'll put your code into the 'official' documentation .. Thank you Am 07/05/2010 10:55, schrieb Nicolas Bouillon: Oups, sorry i had made a mistake when trying this way. I actually worked. public static void contributeServiceOverride( MappedConfiguration configuration) { configuration.add(SaltSourceService.class, new SaltSourceService() { public Object getSalt(UserDetails user) { return ""; } }); } public static void contributeAlias( Configuration> configuration) { configuration.add(AliasContribution.create(PasswordEncoder.class, new Md5PasswordEncoder())); } Sorry for the noise, and thanks for the help. On Thu, 06 May 2010 17:39:01 +0200, Nicolas Bouillon wrote: Unfortunately, it doesn't work. On Thu, 06 May 2010 13:21:18 +0200, Michael Gerzabek wrote: I'm not 100% sure here but think you have to override the SSS. In your AppModule write something like public static void contributeServiceOverride(MappedConfiguration configuration) { configuration.add(SaltSourceService.class, new new SaltSourceService() { public Object getSalt(UserDetails user) { return ""; } }); } Have a look at: http://tapestry.apache.org/tapestry5.1/tapestry-ioc/cookbook/override.html /M Am 06/05/2010 11:02, schrieb Nicolas Bouillon: 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> 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> 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 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 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.ap
Re: [T5.1] tapestry-spring-security : overriding saltsource probleme
Oups, sorry i had made a mistake when trying this way. I actually worked. public static void contributeServiceOverride( MappedConfiguration configuration) { configuration.add(SaltSourceService.class, new SaltSourceService() { public Object getSalt(UserDetails user) { return ""; } }); } public static void contributeAlias( Configuration> configuration) { configuration.add(AliasContribution.create(PasswordEncoder.class, new Md5PasswordEncoder())); } Sorry for the noise, and thanks for the help. On Thu, 06 May 2010 17:39:01 +0200, Nicolas Bouillon wrote: > Unfortunately, it doesn't work. > > On Thu, 06 May 2010 13:21:18 +0200, Michael Gerzabek > wrote: >> I'm not 100% sure here but think you have to override the SSS. In your >> AppModule write something like >> >> public static void >> contributeServiceOverride(MappedConfiguration > configuration) >>{ >> configuration.add(SaltSourceService.class, new new > SaltSourceService() >> { >> public Object getSalt(UserDetails user) { >> return ""; >> } >> }); >>} >> >> Have a look at: >> > http://tapestry.apache.org/tapestry5.1/tapestry-ioc/cookbook/override.html >> /M >> >> Am 06/05/2010 11:02, schrieb Nicolas Bouillon: >>> 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> 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> 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>> > 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>> 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 >>> >>> >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org > > -
Re: [T5.1] tapestry-spring-security : overriding saltsource probleme
ouch, sorry! I don't have the time now to dig deeper but will do tomorrow .. Am 07/05/2010 07:00, schrieb Nicolas Bouillon: Did you tried that ? It doesn't work, because TSS pass this value to the SystemWideSaltSource class from spring add calls the following afterPropertiesSet method : public void afterPropertiesSet() throws Exception { if ((this.systemWideSalt == null) || "".equals(this.systemWideSalt)) { throw new IllegalArgumentException("A systemWideSalt must be set"); } } Le 06/05/2010 21:36, Michael Gerzabek a écrit : well then the only thing you have to do is public static void contributeApplicationDefaults( MappedConfiguration configuration ) { configuration.add( "spring-security.password.salt", "" ); } and everything should work out fine. Am 06.05.2010 21:05, schrieb Nicolas Bouillon: I use the TSS 2.1.0 with Tapestry 5.1.0.5. I just get a login failed, because the default TSS SaltSource is used (with "DEADBEEF" as salt). My database doesn't have salt for password, and setting spring-security.password.salt to the empty string fails (thrown exception from Spring SystemWideSaltSource). The problem is, if i override the SaltSource as explained in http://www.localhost.nu/java/tapestry-spring-security/conf.html # Alias Contributions : sometimes the override works, sometime not. Seems to depends of initialization order. Le 06/05/2010 20:40, Michael Gerzabek a écrit : Which TSS version do you use? Is it 2.1.0? Which T5 version? T 5.1.0.5? Which error do you get? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.1] tapestry-spring-security : overriding saltsource probleme
Did you tried that ? It doesn't work, because TSS pass this value to the SystemWideSaltSource class from spring add calls the following afterPropertiesSet method : public void afterPropertiesSet() throws Exception { if ((this.systemWideSalt == null) || "".equals(this.systemWideSalt)) { throw new IllegalArgumentException("A systemWideSalt must be set"); } } Le 06/05/2010 21:36, Michael Gerzabek a écrit : well then the only thing you have to do is public static void contributeApplicationDefaults( MappedConfiguration configuration ) { configuration.add( "spring-security.password.salt", "" ); } and everything should work out fine. Am 06.05.2010 21:05, schrieb Nicolas Bouillon: I use the TSS 2.1.0 with Tapestry 5.1.0.5. I just get a login failed, because the default TSS SaltSource is used (with "DEADBEEF" as salt). My database doesn't have salt for password, and setting spring-security.password.salt to the empty string fails (thrown exception from Spring SystemWideSaltSource). The problem is, if i override the SaltSource as explained in http://www.localhost.nu/java/tapestry-spring-security/conf.html # Alias Contributions : sometimes the override works, sometime not. Seems to depends of initialization order. Le 06/05/2010 20:40, Michael Gerzabek a écrit : Which TSS version do you use? Is it 2.1.0? Which T5 version? T 5.1.0.5? Which error do you get? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.1] tapestry-spring-security : overriding saltsource probleme
well then the only thing you have to do is public static void contributeApplicationDefaults( MappedConfiguration configuration ) { configuration.add( "spring-security.password.salt", "" ); } and everything should work out fine. Am 06.05.2010 21:05, schrieb Nicolas Bouillon: I use the TSS 2.1.0 with Tapestry 5.1.0.5. I just get a login failed, because the default TSS SaltSource is used (with "DEADBEEF" as salt). My database doesn't have salt for password, and setting spring-security.password.salt to the empty string fails (thrown exception from Spring SystemWideSaltSource). The problem is, if i override the SaltSource as explained in http://www.localhost.nu/java/tapestry-spring-security/conf.html # Alias Contributions : sometimes the override works, sometime not. Seems to depends of initialization order. Le 06/05/2010 20:40, Michael Gerzabek a écrit : Which TSS version do you use? Is it 2.1.0? Which T5 version? T 5.1.0.5? Which error do you get? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.1] tapestry-spring-security : overriding saltsource probleme
I use the TSS 2.1.0 with Tapestry 5.1.0.5. I just get a login failed, because the default TSS SaltSource is used (with "DEADBEEF" as salt). My database doesn't have salt for password, and setting spring-security.password.salt to the empty string fails (thrown exception from Spring SystemWideSaltSource). The problem is, if i override the SaltSource as explained in http://www.localhost.nu/java/tapestry-spring-security/conf.html # Alias Contributions : sometimes the override works, sometime not. Seems to depends of initialization order. Le 06/05/2010 20:40, Michael Gerzabek a écrit : Which TSS version do you use? Is it 2.1.0? Which T5 version? T 5.1.0.5? Which error do you get? - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.1] tapestry-spring-security : overriding saltsource probleme
Which TSS version do you use? Is it 2.1.0? Which T5 version? T 5.1.0.5? Which error do you get? Am 06.05.2010 17:39, schrieb Nicolas Bouillon: Unfortunately, it doesn't work. On Thu, 06 May 2010 13:21:18 +0200, Michael Gerzabek wrote: I'm not 100% sure here but think you have to override the SSS. In your AppModule write something like public static void contributeServiceOverride(MappedConfiguration configuration) { configuration.add(SaltSourceService.class, new new SaltSourceService() { public Object getSalt(UserDetails user) { return ""; } }); } Have a look at: http://tapestry.apache.org/tapestry5.1/tapestry-ioc/cookbook/override.html /M Am 06/05/2010 11:02, schrieb Nicolas Bouillon: 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> 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> 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 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 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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.1] tapestry-spring-security : overriding saltsource probleme
Unfortunately, it doesn't work. On Thu, 06 May 2010 13:21:18 +0200, Michael Gerzabek wrote: > I'm not 100% sure here but think you have to override the SSS. In your > AppModule write something like > > public static void > contributeServiceOverride(MappedConfiguration configuration) >{ > configuration.add(SaltSourceService.class, new new SaltSourceService() > { > public Object getSalt(UserDetails user) { > return ""; > } > }); >} > > Have a look at: > http://tapestry.apache.org/tapestry5.1/tapestry-ioc/cookbook/override.html > /M > > Am 06/05/2010 11:02, schrieb Nicolas Bouillon: >> 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> 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> 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> 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> 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 >> >> > > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.1] tapestry-spring-security : overriding saltsource probleme
I'm not 100% sure here but think you have to override the SSS. In your AppModule write something like public static void contributeServiceOverride(MappedConfiguration configuration) { configuration.add(SaltSourceService.class, new new SaltSourceService() { public Object getSalt(UserDetails user) { return ""; } }); } Have a look at: http://tapestry.apache.org/tapestry5.1/tapestry-ioc/cookbook/override.html /M Am 06/05/2010 11:02, schrieb Nicolas Bouillon: 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> 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> 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 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 (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 - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.1] tapestry-spring-security : overriding saltsource probleme
Yes, I've tried using contributeServiceOverride and this way it never works. The problem is that the SecurityModule create itself a SaltSourceService it needs after for other service initialisation. I need to create the service first, then the SecurityModule fails to register its service, and correctly use my service for its other services init. Btw, The tapestry-security module I use doesn't register a service, but contribute an alias. But I must admin that i don't fully understand how Tapestry IOC works, so I don't know what is the difference and if that matters. On Thu, 6 May 2010 11:07:58 +0200, Robin Komiwes wrote: > 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 > 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> 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> 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 > >> 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 > 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 >> >> - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: [T5.1] tapestry-spring-security : overriding saltsource probleme
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 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> 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> 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 > 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 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 > >