Ahh, then that is the easy one.
Here's a chunk of code I actually use.  Obviously, you will be pulling
the providers from the Spring context rather than injecting, but...

public static void contributeProviderManager(
    OrderedConfiguration<AuthenticationProvider> configuration,
    @InjectService("DaoAuthenticationProvider") AuthenticationProvider
daoAuthenticationProvider,
    @InjectService("LdapAuthenticationProvider")
AuthenticationProvider ldapAuthenticationProvider) {

    configuration.add("daoAuthenticationProvider", daoAuthenticationProvider);
    configuration.add("ldapAuthenticationProvider",ldapAuthenticationProvider);
}


In this case, the daoAuthenticationProvider has a few admin accounts
in it, and most of my users go via LDAP.



On Tue, Nov 22, 2011 at 8:37 AM, Juan Alba <juan.a...@condortech.com.ar> wrote:
>
> First of all thanks for the help Jonathan, but I think that I am not being
> clear.
>
> I already have the two providers (Injecting the applicationcontext as
> derkoe told me before).
>
> Now I want to configure tapestry-spring-security to use both of them so
> that if the user is not authenticated with one provider, the application
> tries to authenticate it with the other provider.
>
> For example:
>
> An user fill in username and password, first it will try to authenticate
> with authenticationProviaderA. If the user is not authenticated, it will
> try to authenticate with authenticationProviderB (This can be ldap for
> example)
>
> Thanks in advacne.
>
> On Mon, Nov 21, 2011 at 5:31 PM, Jonathan Barker <
> jonathan.theit...@gmail.com> wrote:
>
> > Can you move the provider building out of Spring into your AppModule so you
> > can actually specify a service id?
> >
> > Or, as suggested by Chris, pass ApplicationContext into your
> > contributeProviderManager method instead of AuthenticationProvider, and
> > then do appContext.getBean("myBeanId") to get a specific provider to
> > contribute.
> >
> > Or, you can get around it by having your AuthenticationProviders implement
> > different dummy interfaces that extend AuthenticationProvider.  Then, in
> > your contribute method, use your dummy interface instead of
> > AuthenticationProvider to avoid any confusion about which one you want.
> >
> >
> > On Mon, Nov 21, 2011 at 9:31 AM, Juan Alba <juan.a...@condortech.com.ar
> > >wrote:
> >
> > > Chris, thanks for the tip,
> > >
> > > What I am still missing is to assign more than one authenticationProvider
> > > to the  ProviderManager.
> > >
> > > I can see there that it is a List of providers, but I don't know how to
> > set
> > > this list with all my different authenticationProviders.
> > >
> > > Does anybody knows?
> > >
> > >
> > > Thanks in advance!
> > >
> > > On Mon, Nov 21, 2011 at 5:20 AM, derkoe <
> > > tapestry.christian.koeb...@gmail.com> wrote:
> > >
> > > >
> > > > kado wrote
> > > > >
> > > > > Hi,
> > > > >
> > > > > I am trying to add a facebook provider to my app.
> > > > >
> > > > > I added the config to the xml and I had created the  Class
> > > > > FacebookDaoProvider just for testing if everything goes fine but
> > when I
> > > > > start the server this message is shown:
> > > > >
> > > > > Construction of service ProviderManager failed: Error invoking
> > service
> > > > > builder method
> > > > >
> > > >
> > >
> > nu.localhost.tapestry5.springsecurity.services.SecurityModule.buildProviderManager(List)
> > > > > (at SecurityModule.java:333) (for service 'ProviderManager'): Error
> > > > > invoking service contribution method
> > > > >
> > > >
> > >
> > ar.com.condor.services.CondorSecurityModule.contributeProviderManager(OrderedConfiguration,
> > > > > AuthenticationProvider): Spring context contains 2 beans assignable
> > to
> > > > > type
> > > > > org.springframework.security.providers.AuthenticationProvider:
> > > > > daoAuthenticationProvider, facebookDaoProvider.
> > > > >
> > > > > Does anybody know what I am missing or what I am doing wrong?
> > > > >
> > > >
> > > > The problem is that you have 2 Spring beans binding the same type
> > > > (AuthenticationProvider) - Tapestry's injection is based on types, so
> > it
> > > > cannot determine which service to inject.
> > > >
> > > > For a solution you can either eliminate one of the two Spring beans or
> > > > inject ApplicationContext and get the bean manually.
> > > >
> > > > --
> > > > Chris
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > >
> > http://tapestry.1045711.n5.nabble.com/Spring-security-can-t-add-AuthenticationProvider-tp5005539p5009797.html
> > > > Sent from the Tapestry - User mailing list archive at Nabble.com.
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > > > For additional commands, e-mail: users-h...@tapestry.apache.org
> > > >
> > > >
> > >
> >
> >
> >
> > --
> > Jonathan Barker
> > ITStrategic
> >



--
Jonathan Barker
ITStrategic

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

Reply via email to