/** * Returns the host name of the LDAP server to which the object is or * was last connected, in the format originally specified. * * @see <a href="../../../../api/com/novell/ldap/LDAPConnection.html#getHost()"> com.novell.ldap.LDAPConnection.getHost()</a> */ public String getHost() { return conn.getHost(); }
/** * {@inheritDoc} */ public LDAPConnection getConnection() throws LDAPException { if ( log.isDebugEnabled() ) { log.debug("getConnection()"); } LDAPConnection conn = newConnection(); if ( config.isAutoBind() ) { if ( log.isDebugEnabled() ) { log.debug("getConnection(): auto-binding"); } try { bind(conn, config.getLdapUser(), config.getLdapPassword()); } catch (LDAPException ldape) { if (ldape.getResultCode() == LDAPException.INVALID_CREDENTIALS) { log.warn("Failed to bind against: "+ conn.getHost()+ " with user: "+ config.getLdapUser()+ " password: "+ config.getLdapPassword().replaceAll(".", "*")); } throw ldape; } } return conn; }
String cacheKey = getUidAttributeName() + "." + this.connection.getConnection().getHost() + ":" + this.connection.getConnection().getPort();
/** * Get the cache with the provided name for a particular LDAP server. * * @param configuration the configuration to use to create the cache and to find it if it's already created. * @param context the XWiki context. * @return the cache. * @throws CacheException error when creating the cache. */ public Cache<Map<String, String>> getCache(CacheConfiguration configuration, XWikiContext context) throws CacheException { Cache<Map<String, String>> cache; String cacheKey = getUidAttributeName() + "." + this.connection.getConnection().getHost() + ":" + this.connection.getConnection().getPort(); Map<String, Cache<Map<String, String>>> cacheMap; if (cachePool.containsKey(cacheKey)) { cacheMap = cachePool.get(cacheKey); } else { cacheMap = new HashMap<String, Cache<Map<String, String>>>(); cachePool.put(cacheKey, cacheMap); } cache = cacheMap.get(configuration.getConfigurationId()); if (cache == null) { cache = Utils.getComponent(CacheManager.class).createNewCache(configuration); cacheMap.put(configuration.getConfigurationId(), cache); } return cache; }
authzId, "ldap", this.getHost(), props, (CallbackHandler)cbh);