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<Class, Object>  configuration) {
         configuration.add(SaltSourceService.class, new SaltSourceService()
{
             public Object getSalt(UserDetails user) {
                 return "";
             }
         });
     }

     public static void contributeAlias(
             Configuration<AliasContribution<?>>  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<nico...@bouil.org>
wrote:
Unfortunately, it doesn't work.

On Thu, 06 May 2010 13:21:18 +0200, Michael Gerzabek
<michael.gerza...@gmx.net>  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<Class,Object>
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<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



---------------------------------------------------------------------
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

Reply via email to