-
Aug 30th, 2007, 01:53 PM
#1
Change Credentials in JcrSessionFactory
I have a web application built on top of spring-modules 0.8 and jackrabbit 1.3. When users login the web application, they are authenticated by usernames/passwords stored in a database, which is not part of JCR. But they access the repository with the credentials defined in the config file below. In this case, all users access JCR as "bogus".
Now I need to tell the users apart in JCR - Session.getUserId() should return the users' specific username instead of "bogus". I wonder how I can supply JcrSessionFactory with the username/password (passed from web tier dynamically) to replace or overwrite the credentials defined in config file. Thanks in advance.
<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>
-
Mar 7th, 2008, 05:37 PM
#2
still frustrated...
I posted the question a while ago but got no response. I would think this is a common use case. For example, if a user login the web application as "johnsmith", check out/update/check in a document, the node's version control should save "johnsmith" in history. However, using the hard-coded credential in spring config file, the session is always created in the name of "bogus". So "bogus" does everything on behalf of "johnsmith". Thus version control know only "bogus".
I am sure Springmodules/JCR users run into similar problems. How do you work around it? Is it possible to pass "johnsmith" to replace "bogus" for JcrSessionFactory defined the configuration file?
-
Aug 19th, 2008, 09:05 AM
#3
I am also interested in this case. Did you find a solution? I am thinking of rolling my own extension of jcrsessionfactory but wanted to know if there is a better solution....
-
Aug 1st, 2009, 04:21 AM
#4
I've reach this post after two years and I can't found a solution for this problem. Any help?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules