> I'm trying to combine the CHS (Cocoon + Hibernate + Spring) example with
> the authentication-fw.
>
> For example:
> User comes and has to login -> only after succesful login he is able to
> see the products and shop -> ...
>
> Since the CHS has its own datasource and sessionfactory I want to
> "reuse" them for my authentication.
>
> I want to use a java class as the authentication resource, like:
>
> <authentication authenticator="com.MyAuthenticator"/>
>
> My problem is that I don't know how to use the datasource and sessionfactory
> from CHS >in this context.
I've tried to do that at the beginning but it has proven to be more
difficult than necessary. If you manage your users and authentication
data inside the Spring layer it's very easy to write a few flowscript
functions to do that in association with session framework. If you're
interested I can give you my functions and you'll see authentication
framework is not compulsory when using Spring.
As for your first question, you have nothing to really adapt, except
the service bean name. For example if you have a shopService bean,
it's gonna be something like that:
var shop;
function getShop(){
if (shop == null){
var appCtx =
cocoon.context.getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
//This line refers to the application context you've defined in
web.xml
shop = appCtx.getBean("shopService");
return shop;
}
And then each time you need to access your shop, you call getShop()
first to be sure the variable is initialized and you can use it as any
bean.
Good luck
--
Sebastien ARBOGAST
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]