@Override public String getScheme() { return implementation.getScheme(); }
/** * {@inheritDoc} * * forwards to older method {@link #handleAuthentication(ServerCnxn, byte[])} */ @Override public KeeperException.Code handleAuthentication(ServerObjs serverObjs, byte[] authData) { return implementation.handleAuthentication(serverObjs.getCnxn(), authData); }
@Override public boolean isAuthenticated() { return implementation.isAuthenticated(); }
LOG.error("Missing AuthenticationProvider for " + cid.getScheme()); } else if (ap.isAuthenticated()) { authIdValid = true; toAdd.add(new ACL(a.getPerms(), cid)); return false; if (!ap.isValid(id.getId())) { return false;
/** * {@inheritDoc} * * forwards to older method {@link #matches(String, String)} */ @Override public boolean matches(ServerObjs serverObjs, MatchValues matchValues) { return implementation.matches(matchValues.getId(), matchValues.getAclExpr()); }
@Override public boolean isValid(String id) { return implementation.isValid(id); } }
LOG.error("Missing AuthenticationProvider for " + cid.getScheme()); } else if (ap.isAuthenticated()) { authIdValid = true; toAdd.add(new ACL(a.getPerms(), cid)); return false; if (!ap.isValid(id.getId())) { return false;
for (Id authId : ids) { if (authId.getScheme().equals(id.getScheme()) && ap.matches(authId.getId(), id.getId())) { return;
public static void initialize() { synchronized (ProviderRegistry.class) { if (initialized) return; IPAuthenticationProvider ipp = new IPAuthenticationProvider(); DigestAuthenticationProvider digp = new DigestAuthenticationProvider(); authenticationProviders.put(ipp.getScheme(), ipp); authenticationProviders.put(digp.getScheme(), digp); Enumeration<Object> en = System.getProperties().keys(); while (en.hasMoreElements()) { String k = (String) en.nextElement(); if (k.startsWith("zookeeper.authProvider.")) { String className = System.getProperty(k); try { Class<?> c = ZooKeeperServer.class.getClassLoader() .loadClass(className); AuthenticationProvider ap = (AuthenticationProvider) c.getDeclaredConstructor() .newInstance(); authenticationProviders.put(ap.getScheme(), ap); } catch (Exception e) { LOG.warn("Problems loading " + className,e); } } } initialized = true; } }
if(ap != null) { try { authReturn = ap.handleAuthentication(cnxn, authPacket.getAuth()); } catch(RuntimeException e) { LOG.warn("Caught runtime exception from AuthenticationProvider: " + scheme + " due to " + e);
&& ap.matches(authId.getId(), id.getId())) { return;
public static void initialize() { synchronized (ProviderRegistry.class) { if (initialized) return; IPAuthenticationProvider ipp = new IPAuthenticationProvider(); DigestAuthenticationProvider digp = new DigestAuthenticationProvider(); authenticationProviders.put(ipp.getScheme(), ipp); authenticationProviders.put(digp.getScheme(), digp); Enumeration<Object> en = System.getProperties().keys(); while (en.hasMoreElements()) { String k = (String) en.nextElement(); if (k.startsWith("zookeeper.authProvider.")) { String className = System.getProperty(k); try { Class<?> c = ZooKeeperServer.class.getClassLoader() .loadClass(className); AuthenticationProvider ap = (AuthenticationProvider) c .getDeclaredConstructor().newInstance(); authenticationProviders.put(ap.getScheme(), ap); } catch (Exception e) { LOG.warn("Problems loading " + className,e); } } } initialized = true; } }
AuthenticationProvider ap = ProviderRegistry.getProvider(scheme); if (ap == null || (ap.handleAuthentication(this, authPacket.getAuth()) != KeeperException.Code.OK)) { if (ap == null) {
public static void initialize() { synchronized (ProviderRegistry.class) { if (initialized) return; IPAuthenticationProvider ipp = new IPAuthenticationProvider(); DigestAuthenticationProvider digp = new DigestAuthenticationProvider(); authenticationProviders.put(ipp.getScheme(), ipp); authenticationProviders.put(digp.getScheme(), digp); Enumeration<Object> en = System.getProperties().keys(); while (en.hasMoreElements()) { String k = (String) en.nextElement(); if (k.startsWith("zookeeper.authProvider.")) { String className = System.getProperty(k); try { Class<?> c = ZooKeeperServer.class.getClassLoader() .loadClass(className); AuthenticationProvider ap = (AuthenticationProvider) c .newInstance(); authenticationProviders.put(ap.getScheme(), ap); } catch (Exception e) { LOG.warn("Problems loading " + className,e); } } } initialized = true; } }