X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=security%2Fruntime%2Forg.argeo.security.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fsecurity%2Fjcr%2FJcrAuthenticationProvider.java;h=bfa51f5b12d11049d1aa7d33e6174e076fb7b6a8;hb=802beab5459c8da4970215886babb45d968e4639;hp=844984a52b3c75400f1b12460712b52b0acf3c23;hpb=10c220cf49f5b146bac50ed7fe2578135cd466f1;p=lgpl%2Fargeo-commons.git diff --git a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/JcrAuthenticationProvider.java b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/JcrAuthenticationProvider.java index 844984a52..bfa51f5b1 100644 --- a/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/JcrAuthenticationProvider.java +++ b/security/runtime/org.argeo.security.core/src/main/java/org/argeo/security/jcr/JcrAuthenticationProvider.java @@ -1,9 +1,6 @@ package org.argeo.security.jcr; -import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; -import java.util.List; import java.util.Map; import javax.jcr.Node; @@ -26,7 +23,7 @@ import org.springframework.security.providers.AuthenticationProvider; /** Connects to a JCR repository and delegate authentication to it. */ public class JcrAuthenticationProvider implements AuthenticationProvider { - private List repositoryFactories = new ArrayList(); + private RepositoryFactory repositoryFactory; private final String defaultHome; private final String userRole; @@ -58,10 +55,7 @@ public class JcrAuthenticationProvider implements AuthenticationProvider { parameters.put(ArgeoJcrConstants.JCR_REPOSITORY_URI, url); Repository repository = null; - for (Iterator it = repositoryFactories - .iterator(); it.hasNext();) { - repository = it.next().getRepository(parameters); - } + repository = repositoryFactory.getRepository(parameters); if (repository == null) return null; @@ -120,9 +114,14 @@ public class JcrAuthenticationProvider implements AuthenticationProvider { } } - public void setRepositoryFactories( - List repositoryFactories) { - this.repositoryFactories = repositoryFactories; + public void register(RepositoryFactory repositoryFactory, + Map parameters) { + this.repositoryFactory = repositoryFactory; + } + + public void unregister(RepositoryFactory repositoryFactory, + Map parameters) { + this.repositoryFactory = null; } public String getDefaultHome() {