Question Is there a bean I can wire into src/main/resources/applicationContext-dao.xml that provide access to the following properties for a request: logged-in username, IP address the request originated from ??
I am thinking the ACEGI framework (or an appfuse class that implements and ACEGI interface) should provide this. Ideally the bean could be extended to also return the object id (primary key) of the username record - but I'll settle for just getting the username back for now. Background I'm continuing to implement the AuditInfo pattern for a Struts2-Hibernate application I generated from Appfuse 2.0.1. Here's a reference to the pattern in case anyone is interested: http://www.hibernate.org/48.html I'm trying to do this in a general way using "org.appfuse" packages so I can hopefully offer it back as a patch. This way all of your database rows can easily opt to have the "who, where and when" chicken tracks for both the creator and the last updater. My Hibernate Interceptor needs to be passed as the "entityInterceptor" parameters to "org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" in applicationContext-dao.xml. I believe I understand how to register a bean for my interceptor and pass it in to the session factory. But I've got to get the current logged-in user and IP address into the Interceptor also. In the past I've done this using the ActionFilter from earlier Appfuse examples. Just not sure how to make it happen here with Spring and ACEGI in the picture. Here's what I've go so far for the applicationContext-dao.xml: <!-- Entity Interceptor bean - sets audit fields for each persistent object --> <bean id="auditInterceptor" class="org.appfuse.model.hibernate.AuditInterceptor"> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="configLocation" value="classpath:hibernate.cfg.xml"/> <property name="hibernateProperties"> <value> hibernate.dialect=${hibernate.dialect} hibernate.query.substitutions=true 'Y', false 'N' hibernate.cache.use_second_level_cache=true hibernate.cache.provider_class=org.hibernate.cache.EhCacheProvider </value> <!-- Turn batching off for better error messages under PostgreSQL --> <!-- hibernate.jdbc.batch_size=0 --> </property> <property name="entityInterceptor" ref="auditInterceptor"/> </bean> I'm thinking that I need to inject some bean as a parameter into auditInterceptor. Thanks again for such a great product. -- View this message in context: http://www.nabble.com/How-to-get-authentication-info-into-a-Spring-bean---Hibernate-interceptor-tp15247474s2369p15247474.html Sent from the AppFuse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
