Hi Francisco, I got the error mentioned at [1]. I'm going to build the trunk & try the SNAPSHOT. Will keep the thread updated.
1. https://issues.apache.org/jira/browse/JCR-3076 On Sun, Sep 25, 2011 at 5:56 PM, Francisco Carriedo Scher < [email protected]> wrote: > User management is currently not supported when you get the repository > object through RMI. Try the same code getting the repository through Webdav: > > Repository repository = > > JcrUtils.getRepository("http://localhost:8080/server<http://localhost/jackrabbit/server> > "); > > (check the parameter "http..." in Jackrabbit's documentation since did not > check it, but it should work like that). > > Greetings! > > > > > 2011/9/25 Saminda Wijeratne <[email protected]> > >> Hi, >> >> Thanks for the insight. I've updated the repository.xml as mentioned & >> executed the code. When getUserManager() is called an exception was >> thrown, >> Exception in thread "main" >> javax.jcr.UnsupportedRepositoryOperationException: UserManager not >> supported. >> at >> org.apache.jackrabbit.core.security.simple.SimpleSecurityManager.getUserManager(SimpleSecurityManager.java:254) >> at >> org.apache.jackrabbit.core.SessionImpl.getUserManager(SessionImpl.java:652) >> at FirstHop.main(FirstHop.java:32) >> >> When I debugged the session object it had a null for the userManager >> variable. Do I need to change anything else in the repository.xml >> >> Thanks, >> Saminda >> >> >> On Sun, Sep 25, 2011 at 7:18 AM, Francisco Carriedo Scher < >> [email protected]> wrote: >> >>> Hi there, >>> >>> you were on the right path, anyway i paste here a code snipet to >>> correctly create users. Since you mentioned the simple security manager i >>> will specify a little bit more what "correct" means: users who later will be >>> managed for access control by Jackrabbit. >>> >>> >>> The code for creating users: >>> >>> Repository repository = new TransientRepository(); >>> BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); >>> Session session = repository.login(new SimpleCredentials("admin", >>> "admin".toCharArray())); >>> >>> if (session instanceof JackrabbitSession) { >>> umgr = ((JackrabbitSession) session).getUserManager(); >>> } >>> >>> System.out.println("Input username and password: "); >>> umgr.createUser(br.readLine(), br.readLine()); >>> // Reaching this point with no exception means that the user was >>> successfully created >>> >>> >>> Prior to run the code above, the configuration for access management in >>> repository.xml file must be completed. You need to specify the following >>> classes (but no need to instantiate them in your code, it is used internally >>> by Jackrabbit through JAAS (have a look >>> http://download.oracle.com/javase/6/docs/technotes/guides/security/jaas/JAASRefGuide.html). >>> Basically Jackrabbit uses JAAS for authentication (know if you are who you >>> claim to be through username and password) and it's own ACLs for >>> authentication (know if you are allowed to perform an action) : >>> >>> <SecurityManager >>> class="org.apache.jackrabbit.core.DefaultSecurityManager" >>> workspaceName="security"> >>> ... >>> <AccessManager >>> class="org.apache.jackrabbit.core.security.DefaultAccessManager"> >>> ... >>> <LoginModule >>> class="org.apache.jackrabbit.core.security.authentication.DefaultLoginModule"> >>> >>> >>> >>> For setting ACLs details check >>> http://wiki.apache.org/jackrabbit/AccessControl >>> >>> Hope that helps! >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> 2011/9/25 Saminda Wijeratne <[email protected]> >>> >>>> Hi, >>>> >>>> I'm new to using JackRabbit repository. I couldn't find a similar >>>> question >>>> on the archives. I just want to programatically create a user for >>>> JackRabbit >>>> registry. >>>> >>>> I was attempting to use the JackRabbit API. >>>> >>>> HashMap<String, String> map = new HashMap<String, String>(); >>>> map.put("org.apache.jackrabbit.repository.uri", " >>>> http://localhost:8080/rmi"); >>>> Repository repository = new >>>> RmiRepositoryFactory().getRepository(map); >>>> Credentials credentials=new SimpleCredentials("admin", new >>>> String("admin").toCharArray()); >>>> Session session = repository.login(credentials); >>>> >>>> >>>> Tried to initialize the SimpleSecurityManager to get the UserManager >>>> object. >>>> >>>> SimpleSecurityManager simpleSecurityManager = new >>>> SimpleSecurityManager(); >>>> simpleSecurityManager.init(repository, session); >>>> >>>> But calling init method throws the following, >>>> javax.jcr.RepositoryException: RepositoryImpl expected >>>> at >>>> >>>> org.apache.jackrabbit.core.security.simple.SimpleSecurityManager.init(SimpleSecurityManager.java:127) >>>> at FirstHop.main(FirstHop.java:38) >>>> >>>> Looking at the impl of the init method showed that the repository >>>> parameter >>>> expected in the init method looks for a specific implementation of >>>> RepositoryImpl class. From where can this object be derived from the >>>> existing repository object? Or is the way I'm doing this is all wrong? >>>> >>>> Thanks in advance, >>>> Saminda >>>> >>> >>> >> >
