jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AshokBS <asidda...@altimetrik.com>
Subject Re: AW: How to create users using jackrabbit?
Date Wed, 05 Mar 2014 06:08:05 GMT
Hi Malzer,

Thanks for your response. I have seen some differences while doing this
activity of creating users.

Scenario1: I try to use TransientRepository and then login with admin
credentials and go ahead to create users, it is working fine. But the fact
is i am unable to login to the repository URL say something like:
http://localhost:9090/repository/default/

The code was something like this to create testuser:
Repository repository = new TransientRepository();
Session session = repository.login(new SimpleCredentials("admin",
"admin".toCharArray()));

final UserManager userManager = ((JackrabbitSession)
session).getUserManager();
final User user2 = userManager.createUser("testuser", "testuser");
session.save();

Why iam unable to login with testuser to the above URL? I mean where have we
mapping testuser to the above URL in this code.

Scenario2: I try to use JCRUtils API to get repository which is running and
try to login say something like this:
Repository repository =
JcrUtils.getRepository("http://localhost:9090/server");
Session session = repository.login(new SimpleCredentials("admin",
"admin".toCharArray()));
 UserManager um = ((JackrabbitSession) session).getUserManager();
User user = um.createUser("testuser", "testuser"); 

The above one will not allow me to create users as said earlier and give the
exception as: java.lang.ClassCastException:
org.apache.jackrabbit.jcr2spi.SessionImpl cannot be cast to
org.apache.jackrabbit.api.JackrabbitSession

Why is this happening? My queston is from scenario 1: where does the users
data reside and how to login to web browser to URL? Is it not possible to
use those created users for login?










--
View this message in context: http://jackrabbit.510166.n4.nabble.com/How-to-create-users-using-jackrabbit-tp4660409p4660417.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Mime
View raw message