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


Java LdapUtils.containsResultEntry方法代码示例

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


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

示例1: submit

import org.jasig.cas.util.LdapUtils; //导入方法依赖的package包/类
@Override
public boolean submit(final RequestContext requestContext, final Credential credential) {

    String currentDn = null;
    try (Connection searchConnection = LdapUtils.createConnection(this.connectionFactory)) {
        final Response<SearchResult> response = searchForId(searchConnection, credential.getId());
        if (LdapUtils.containsResultEntry(response)) {
            currentDn = response.getResult().getEntry().getDn();
        }
    } catch (final Exception e) {
        logger.error(e.getMessage(), e);
    }

    if (StringUtils.isNotBlank(currentDn)) {
        logger.debug("Updating {}", currentDn);
        return LdapUtils.executeModifyOperation(currentDn, this.connectionFactory,
                Collections.singletonMap(this.aupAttributeName, 
                        Collections.singleton(Boolean.TRUE.toString())));
    }
    return false;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:22,代码来源:LdapAcceptableUsagePolicyRepository.java

示例2: update

import org.jasig.cas.util.LdapUtils; //导入方法依赖的package包/类
/**
 * Update the ldap entry with the given registered service.
 *
 * @param rs the rs
 * @return the registered service
 */
private RegisteredService update(final RegisteredService rs) {
    String currentDn = null;

    if (ldapServiceMapper == null) {
        return null;
    }

    try {
        final Response<SearchResult> response = searchForServiceById(rs.getId());
        if (LdapUtils.containsResultEntry(response)) {
            currentDn = response.getResult().getEntry().getDn();
        }
    } catch (final Exception e) {
        logger.error(e.getMessage(), e);
    }

    if (StringUtils.isNotBlank(currentDn)) {
        logger.debug("Updating registered service at {}", currentDn);
        final LdapEntry entry = this.ldapServiceMapper.mapFromRegisteredService(this.baseDn, rs);
        LdapUtils.executeModifyOperation(currentDn, this.connectionFactory, entry);
    }

    return rs;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:31,代码来源:LdapServiceRegistryDao.java

示例3: load

import org.jasig.cas.util.LdapUtils; //导入方法依赖的package包/类
@Override
public List<RegisteredService> load() {
    final List<RegisteredService> list = new LinkedList<>();
    if (ldapServiceMapper == null) {
        return list;
    }

    try {
        final Response<SearchResult> response = LdapUtils.executeSearchOperation(this.connectionFactory,
                this.baseDn, new SearchFilter(this.loadFilter));
        if (LdapUtils.containsResultEntry(response)) {
            for (final LdapEntry entry : response.getResult().getEntries()) {
                final RegisteredService svc = this.ldapServiceMapper.mapToRegisteredService(entry);
                list.add(svc);
            }
        }
    } catch (final LdapException e) {
        logger.error(e.getMessage(), e);
    }
    return list;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:22,代码来源:LdapServiceRegistryDao.java

示例4: delete

import org.jasig.cas.util.LdapUtils; //导入方法依赖的package包/类
@Override
public boolean delete(final RegisteredService registeredService) {
    try {
        final Response<SearchResult> response = searchForServiceById(registeredService.getId());
        if (LdapUtils.containsResultEntry(response)) {
            final LdapEntry entry = response.getResult().getEntry();
            return LdapUtils.executeDeleteOperation(this.connectionFactory, entry);
        }
    } catch (final LdapException e) {
        logger.error(e.getMessage(), e);
    }
    return false;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:14,代码来源:LdapServiceRegistryDao.java

示例5: findServiceById

import org.jasig.cas.util.LdapUtils; //导入方法依赖的package包/类
@Override
public RegisteredService findServiceById(final long id) {
    try {
        if (this.ldapServiceMapper != null) {
            final Response<SearchResult> response = searchForServiceById(id);
            if (LdapUtils.containsResultEntry(response)) {
                return this.ldapServiceMapper.mapToRegisteredService(response.getResult().getEntry());
            }
        }
    } catch (final LdapException e) {
        logger.error(e.getMessage(), e);
    }
    return null;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:15,代码来源:LdapServiceRegistryDao.java


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