Skip to content

Instantly share code, notes, and snippets.

@auniverseaway
Created October 27, 2015 18:31
Show Gist options
  • Save auniverseaway/8efe397edcef2d030641 to your computer and use it in GitHub Desktop.
Save auniverseaway/8efe397edcef2d030641 to your computer and use it in GitHub Desktop.
Automatically log user in...
// Get our current resolver.
ResourceResolver resolver = request.getResourceResolver();
// Adapt to an anonymous session and get the repo as anonymous.
JackrabbitSession session = (JackrabbitSession) resolver.adaptTo(Session.class);
Repository repository = session.getRepository();
// Create a new session by logging into using the default admin username and password.
Session adminSession = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment