class CredentialsCacheBean {

    @GET
    @Path("/{dn}/list")
    @Produces({"text/plain", "application/xml", "text/xml", "application/json", "text/html"})
    @JmxManaged
    public DatawaveUser list(@PathParam("dn") String dn) {
        DatawaveUser user;
        if (!cachedDatawaveUserServiceInstance.isUnsatisfied()) {
            user = cachedDatawaveUserServiceInstance.get().list(dn);
        } else {
            // @formatter:off
            user = authManager.getCachedKeys().parallelStream()
                    .filter(p -> p instanceof DatawavePrincipal)
                    .flatMap(p -> ((DatawavePrincipal) p).getProxiedUsers().stream())
                    .filter(p -> p.getName().equals(dn))
                    .findFirst()
                    .orElse(null);
            // @formatter:on
        }
        return user;
    }

}