Hi,
I intend to use jackrabbit with custom authentication and authorization. So
each user which logs in to application would have different access rights on
repository and typically he would be having a separate session. I am also
planning to use springmodules for JCR and I saw some samples for it. Below
is one such sample.
But the problem in this approach is that JcrSessionFactory is been
initialized with a fix set of credentials. So my question is there any way
that I can use custom authentication and authorization and still use
springmodules to get benefits offered by springmodules like declarative
transactions, JcrTemplate etc.
Spring Context -->
<bean id="repository"
class="org.springmodules.jcr.jackrabbit.RepositoryFactoryBean">
<!-- normal factory beans params -->
<property name="configuration" value="classpath:jackrabbit-repo.xml"/>
<property name="homeDir" value="/repo"/>
</bean>
<bean id="sessionFactory"
class="org.springmodules.jcr.JcrSessionFactory">
<property name="repository" ref="repository"/>
<property name="credentials">
<bean class="javax.jcr.SimpleCredentials">
<constructor-arg index="0" value="bogus"/>
<!-- create the credentials using a bean factory -->
<constructor-arg index="1">
<bean factory-bean="password"
factory-method="toCharArray"/>
</constructor-arg>
</bean>
</property>
</bean>
<!-- create the password to return it as a char[] -->
<bean id="password" class="java.lang.String">
<constructor-arg index="0" value="pass"/>
</bean>
<bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate">
<property name="sessionFactory" ref="sessionFactory"/>
<property name="allowCreate" value="true"/>
</bean>
Thanks,
Anand.