Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save saulovenancio/7c7a2a7b249e7dcf18ef to your computer and use it in GitHub Desktop.
Save saulovenancio/7c7a2a7b249e7dcf18ef 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