You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Dave Dombrosky <do...@gmail.com> on 2008/04/08 19:07:29 UTC

Re: How to override a service create with @Marker

Is there still no solution to this problem?  I am also trying to
override the default SaltSource, but the tapestry5-acegi package
always wants to use the one it defines.

I tried using contributions to Alias and AliasOverrides, and also
annotating my own buildMySaltSource() method with
@Marker(AcegiServices.class), but nothing seems to work.

I can get the two services to conflict and throw the following error,
but this is as far as I've gotten:

Exception constructing service 'DaoAuthenticationProvider': Error
invoking service builder method
nu.localhost.tapestry.acegi.services.SecurityModule.buildDaoAuthenticationProvider(UserDetailsService,
PasswordEncoder, SaltSource) (at SecurityModule.java:267) (for service
'DaoAuthenticationProvider'): Unable to locate a single service
assignable to type org.acegisecurity.providers.dao.SaltSource with
marker annotation nu.localhost.tapestry.acegi.services.AcegiServices.

-Dave

On Fri, Mar 21, 2008 at 5:04 AM, Christian Gorbach <go...@gmx.at> wrote:
>
>  hmm.....
>  I'm also interested in a solution for this issue..
>  anyone?
>  c)hristian
>
>
>
>
>
>
>  Robin Helgelin wrote:
>  >
>  > Any help on this? Howard?
>  >
>  > On Sun, Mar 16, 2008 at 12:16 PM, Robin Helgelin <lo...@gmail.com> wrote:
>  >> Hi,
>  >>
>  >>  This is my SaltSource service from tapestry5-acegi package.
>  >>
>  >>     @Marker(AcegiServices.class)
>  >>     public static SaltSource buildSaltSource(@Inject
>  >>  @Value("${acegi.password.salt}") final String salt) {
>  >>         SystemWideSaltSource s = new SystemWideSaltSource();
>  >>         s.setSystemWideSalt(salt);
>  >>         return s;
>  >>     }
>  >>
>  >>  How do I go ahead a create an alias override for that? This code from
>  >>  my example application seemed to work before I added the @Marker
>  >>  annotation.
>  >>
>  >>     public static void bind(ServiceBinder binder) {
>  >>         binder.bind(SaltSource.class,
>  >>  SaltSourceImpl.class).withId("MySaltSource");
>  >>     }
>  >>
>  >>     public static SaltSource buildMySaltSource() throws Exception {
>  >>         SaltSourceImpl saltSource = new SaltSourceImpl();
>  >>         saltSource.setSystemWideSalt("ANOTHERBEEFYSALT");
>  >>         saltSource.afterPropertiesSet();
>  >>         return saltSource;
>  >>     }
>  >>
>  >>     public static void contributeAlias(@InjectService("MySaltSource")
>  >>  SaltSource saltSource,
>  >>             Configuration<AliasContribution> configuration) {
>  >>         configuration.add(AliasContribution.create(SaltSource.class,
>  >>  saltSource));
>  >>     }
>  >>
>  >>
>  >>  --
>  >>   regards,
>  >>   Robin
>  >>
>  >
>  >
>  >
>  > --
>  >  regards,
>  >  Robin
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  > For additional commands, e-mail: users-help@tapestry.apache.org
>  >
>  >
>  >
>
>  --
>  View this message in context: http://www.nabble.com/How-to-override-a-service-create-with-%40Marker-tp16077914p16194944.html
>  Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>  For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: How to override a service create with @Marker

Posted by Robin Helgelin <lo...@gmail.com>.
On Tue, Apr 8, 2008 at 7:24 PM, Robin Helgelin <lo...@gmail.com> wrote:
> On Tue, Apr 8, 2008 at 7:07 PM, Dave Dombrosky <do...@gmail.com> wrote:
>  > Is there still no solution to this problem?  I am also trying to
>  >  override the default SaltSource, but the tapestry5-acegi package
>  >  always wants to use the one it defines.
>  >
>  >  I tried using contributions to Alias and AliasOverrides, and also
>  >  annotating my own buildMySaltSource() method with
>  >  @Marker(AcegiServices.class), but nothing seems to work.
>
>  Yes, I'll have a solution for this, I'll have a new 1.0.4-SNAPSHOT out
>  in a day or two that fixes this.

Ok, here we go. I've uploaded a 1.1.0-SNAPSHOT which fixes the problem
by introducing a new interface that only extends the acegi SaltSource
interface. I'll leave it as a snapshot for a few days, then I'll
release the 1.1.0 release.

>From my example project:
    public static void bind(ServiceBinder binder) {
        binder.bind(SaltSourceService.class,
SaltSourceImpl.class).withId("MySaltSource");
    }

    public static SaltSourceService buildMySaltSource() throws Exception {
        SaltSourceImpl saltSource = new SaltSourceImpl();
        saltSource.setSystemWideSalt("BBEEF");
        saltSource.afterPropertiesSet();
        return saltSource;
    }

    public static void
contributeAliasOverrides(@InjectService("MySaltSource")
SaltSourceService saltSource,
            Configuration<AliasContribution> configuration) {
        configuration.add(AliasContribution.create(SaltSourceService.class,
saltSource));
    }

-- 
 regards,
 Robin

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


Re: How to override a service create with @Marker

Posted by Robin Helgelin <lo...@gmail.com>.
On Tue, Apr 8, 2008 at 7:07 PM, Dave Dombrosky <do...@gmail.com> wrote:
> Is there still no solution to this problem?  I am also trying to
>  override the default SaltSource, but the tapestry5-acegi package
>  always wants to use the one it defines.
>
>  I tried using contributions to Alias and AliasOverrides, and also
>  annotating my own buildMySaltSource() method with
>  @Marker(AcegiServices.class), but nothing seems to work.

Yes, I'll have a solution for this, I'll have a new 1.0.4-SNAPSHOT out
in a day or two that fixes this.

-- 
 regards,
 Robin

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