当前位置: 首页>>代码示例>>Java>>正文


Java LdapEntry.getAttributes方法代码示例

本文整理汇总了Java中org.ldaptive.LdapEntry.getAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java LdapEntry.getAttributes方法的具体用法?Java LdapEntry.getAttributes怎么用?Java LdapEntry.getAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.ldaptive.LdapEntry的用法示例。


在下文中一共展示了LdapEntry.getAttributes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createLdapEntries

import org.ldaptive.LdapEntry; //导入方法依赖的package包/类
/**
 * Creates the given LDAP entries.
 *
 * @param connection Open LDAP connection used to connect to directory.
 * @param entries Collection of LDAP entries.
 *
 * @throws Exception On LDAP errors.
 */
public static void createLdapEntries(final LDAPConnection connection, final Collection<LdapEntry> entries) throws Exception {
    for (final LdapEntry entry : entries) {
        final Collection<Attribute> attrs = new ArrayList<>(entry.getAttributeNames().length);
        for (final LdapAttribute a : entry.getAttributes()) {
            attrs.add(new Attribute(a.getName(), a.getStringValues()));
        }
        connection.add(new AddRequest(entry.getDn(), attrs));
    }
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:18,代码来源:LdapTestUtils.java

示例2: executeModifyOperation

import org.ldaptive.LdapEntry; //导入方法依赖的package包/类
/**
 * Execute modify operation boolean.
 *
 * @param currentDn         the current dn
 * @param connectionFactory the connection factory
 * @param entry             the entry
 * @return the boolean
 */
public static boolean executeModifyOperation(final String currentDn,
                                             final ConnectionFactory connectionFactory,
                                             final LdapEntry entry) {
    final Map<String, Set<String>> attributes = new HashMap<>(entry.getAttribute().size());
    for (final LdapAttribute ldapAttribute : entry.getAttributes()) {
        attributes.put(ldapAttribute.getName(), ImmutableSet.copyOf(ldapAttribute.getStringValues()));
    }
    return executeModifyOperation(currentDn, connectionFactory, attributes);
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:18,代码来源:LdapUtils.java

示例3: convertLdapEntryToMap

import org.ldaptive.LdapEntry; //导入方法依赖的package包/类
/**
 * Converts an ldaptive <code>LdapEntry</code> containing result entry attributes into an attribute map as needed
 * by Person Directory components.
 *
 * @param entry Ldap entry.
 *
 * @return Attribute map.
 */
private Map<String, List<Object>> convertLdapEntryToMap(final LdapEntry entry) {
    final Map<String, List<Object>> attributeMap = new LinkedHashMap<>(entry.size());
    for (final LdapAttribute attr : entry.getAttributes()) {
        attributeMap.put(attr.getName(), new ArrayList<Object>(attr.getStringValues()));
    }
    logger.debug("Converted ldap DN entry [{}] to attribute map {}", entry.getDn(), attributeMap.toString());
    return attributeMap;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:LdapPersonAttributeDao.java

示例4: convertLdapEntryToMap

import org.ldaptive.LdapEntry; //导入方法依赖的package包/类
/**
 * Converts an ldaptive <code>LdapEntry</code> containing result entry attributes into an attribute map as needed
 * by Person Directory components.
 *
 * @param entry Ldap entry.
 *
 * @return Attribute map.
 */
private Map<String, List<Object>> convertLdapEntryToMap(final LdapEntry entry) {
    final Map<String, List<Object>> attributeMap = new LinkedHashMap<String, List<Object>>(entry.size());
    for (final LdapAttribute attr : entry.getAttributes()) {
        attributeMap.put(attr.getName(), new ArrayList<Object>(attr.getStringValues()));
    }
    logger.debug("Converted ldap DN entry [{}] to attribute map {}", entry.getDn(), attributeMap.toString());
    return attributeMap;
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:17,代码来源:LdapPersonAttributeDao.java

示例5: update

import org.ldaptive.LdapEntry; //导入方法依赖的package包/类
private RegisteredService update(final RegisteredService rs) {
    Connection searchConnection = null;
    try {
        searchConnection = this.connectionFactory.getConnection();
        final Response<SearchResult> response = searchForServiceById(searchConnection, rs.getId());
        if (hasResults(response)) {
            final String currentDn = response.getResult().getEntry().getDn();

            Connection modifyConnection = null;
            try {
                modifyConnection = this.connectionFactory.getConnection();
                final ModifyOperation operation = new ModifyOperation(searchConnection);

                final List<AttributeModification> mods = new ArrayList<AttributeModification>();

                final LdapEntry entry = this.ldapServiceMapper.mapFromRegisteredService(this.searchRequest.getBaseDn(), rs);
                for (final LdapAttribute attr : entry.getAttributes()) {
                    mods.add(new AttributeModification(AttributeModificationType.REPLACE, attr));
                }
                final ModifyRequest request = new ModifyRequest(currentDn, mods.toArray(new AttributeModification[] {}));
                operation.execute(request);
            } finally {
                LdapUtils.closeConnection(modifyConnection);
            }
        }
    } catch (final LdapException e) {
        logger.error(e.getMessage(), e);
    } finally {
        LdapUtils.closeConnection(searchConnection);
    }
    return rs;
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:33,代码来源:LdapServiceRegistryDao.java


注:本文中的org.ldaptive.LdapEntry.getAttributes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。