0
votes

I'm using JCR and Jackrabbit Oak implementation. I want to get session with admin user with this code:

Credentials credentials = new SimpleCredentials("admin", "admin".toCharArray());
return repository.login(credentials);

but in the return session the parameters have null, for example accessControlManager and userManager.

My JCR configuration:

jcr.with(securityProvider)
                .with(new LuceneIndexEditorProvider())
                .with((QueryIndexProvider) indexProvider)
                .with((Observer) indexProvider)
                .withAsyncIndexing("async", 5);
        repository = jcr.createRepository();

Can I login with admin user? Otherwise can I create a new user?

1

1 Answers

0
votes

Please use below code:

Repository jcrRepository = (Repository) initCtx.lookup(jcrJndiResource); return jcrRepository.login(new SimpleCredentials(userName,password.toCharArray()), "default");