Hi Simer Anand,
Below is the possible code that makes things a little clear for you:
//UserService is any userservice/dao, that creates user object in your
database ?
@Override
public User createUser(String userID, String password) throws
AuthorizableExistsException, RepositoryException {
User user = null;
if(this.userService.exists(userId)){
throw new AuthorizableExistsException();
}
try{
user = this.userService.create(userId,password)
}catch(Exception e){
throw new RepositoryException(e.getMessage());
}
return user;
}
// You can ignore intermediate path if it doesnt make any sense in your
case
@Override
public User createUser(String userID, String password, Principal
principal, String intermediatePath)
throws AuthorizableExistsException, RepositoryException {
return createUser(userID, password);
}
Ignore principal, unless you are using the userId as principal.
-Amjed
simer anand wrote:
>
> Hello amjedonline and users,
>
> I went through the source code
> of the UserManger class that is
> org.apache.jackrabbit.api.security.user.UserManager and found some methods
> as create user(String UserId , String Password) but being doing it first
> time don't know how i can configure it . So any one who can provide me
> with some sample programs.
>
>
> User createUser(String userID, String password) throws
> AuthorizableExistsException, RepositoryException;
> /**
> * Creates an User for the given userID that authenitcates with the
> given
> * {...@link javax.jcr.Credentials Credentials} and returns the specified
> * Principal upon {...@link User#getPrincipal()}. If the implementation
> is not
> * able to deal with the <code>itermediatePath</code> that parameter
> should
> * be ignored.
> * Except for the <code>itermediatePath</code>, neither of the
> specified
> * parameters can be <code>null</code>.
> *
> * @param userID
> * @param password
> * @param principal
> * @param intermediatePath
> * @return The new <code>User</code>.
> * @throws AuthorizableExistsException in case the given userID is
> already
> * in use or another Authorizable with the same principal name exists.
> * @throws RepositoryException If the current Session is
> * not allowed to create users or some another error occurs.
> */
>
>
> I' m stuck in this issue please help
> Thanks
> simer
>
>
--
View this message in context:
http://www.nabble.com/how-can-i-add-new-users-and-store-them-in-repository-tp25430694p25469191.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.