Ok, I'm not proud of this, but so far this is what I've come up with for
getting the admin password from the repository configuration so that I can use
the new resourceResolverFactory.getServiceResourceResolver(credentials) way.
Configuration[] configs =
configAdmin.listConfigurations("(service.factoryPid=org.apache.sling.jcr.jackrabbit.server.SlingServerRepository)");
for (Configuration aConfig : configs) {
Dictionary props = aConfig.getProperties();
LOGGER.debug(props != null ?
props.get("admin.password").toString() : "null");
}
I can put this in my service to get the admin user's password.
But is there a more straightforward way? This pulls it out of the
configuration, but is there a way to pull it out of the repository/user itself?
Should I instead be using the
org.apache.jackrabbit.api.security.user.UserManager to get the User, then
org.apache.jackrabbit.api.security.user.User getCredentials method?
Rob
On Oct 19, 2013, at 5:57 PM, Robert A. Decker wrote:
> Hi,
>
> I'm trying out the new recommended way of getting access to your repository
> (no longer using loginAdministrative/getAdministrativeResourceResolver).
>
> I see that you can get credentials from SlingServerRepository:
> SlingServerRepository.getAdministrativeCredentials(String adminUser) to get
> my admin user's credential information.
>
> But it doesn't look like it's exposed through a service.
>
> If you go to:
> http://server/system/console/status-Configurations
>
> You can see your admin user's credentials.
>
> Is there a recommended way to access a user's credentials? I don't want to
> put them in config files.
>
> Rob