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


Java CommonHelper.isNotEmpty方法代码示例

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


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

示例1: internalInit

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
@Override
protected void internalInit(final WebContext context) {
    CommonHelper.assertNotNull("configuration", configuration);

    configuration.init(context);

    // check authentication methods
    final List<ClientAuthenticationMethod> metadataMethods = configuration.getProviderMetadata().getTokenEndpointAuthMethods();

    final ClientAuthenticationMethod chosenMethod;
    final ClientAuthenticationMethod configurationMethod = configuration.getClientAuthenticationMethod();
    if (CommonHelper.isNotEmpty(metadataMethods)) {
        if (metadataMethods.contains(configurationMethod)) {
            chosenMethod = configurationMethod;
        } else {
            chosenMethod = metadataMethods.get(0);
            logger.warn("Preferred token endpoint Authentication method: {} not available. Defaulting to: {}",
                    configurationMethod, chosenMethod);
        }
    } else {
        chosenMethod = ClientAuthenticationMethod.getDefault();
        logger.warn("Provider metadata does not provide Token endpoint authentication methods. Defaulting to: {}",
                chosenMethod);
    }

    final ClientID _clientID = new ClientID(configuration.getClientId());
    final Secret _secret = new Secret(configuration.getSecret());
    if (ClientAuthenticationMethod.CLIENT_SECRET_POST.equals(chosenMethod)) {
        clientAuthentication = new ClientSecretPost(_clientID, _secret);
    } else if (ClientAuthenticationMethod.CLIENT_SECRET_BASIC.equals(chosenMethod)) {
        clientAuthentication = new ClientSecretBasic(_clientID, _secret);
    } else {
        throw new TechnicalException("Unsupported client authentication method: " + chosenMethod);
    }
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:36,代码来源:OidcAuthenticator.java

示例2: addContext

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
protected final void addContext(final SAML2MetadataResolver entityId, final BaseContext parentContext,
                                final QName elementName) {
    final EntityDescriptor entityDescriptor;
    final RoleDescriptor roleDescriptor;
    try {
        final CriteriaSet set = new CriteriaSet();
        set.add(new EntityIdCriterion(entityId.getEntityId()));

        entityDescriptor = this.metadata.resolveSingle(set);
        if (entityDescriptor == null) {
            throw new SAMLException("Cannot find entity " + entityId + " in metadata provider");
        }
        final List<RoleDescriptor> list = entityDescriptor.getRoleDescriptors(elementName,
                SAMLConstants.SAML20P_NS);
        roleDescriptor = CommonHelper.isNotEmpty(list) ? list.get(0) : null;

        if (roleDescriptor == null) {
            throw new SAMLException("Cannot find entity " + entityId + " or role "
                    + elementName + " in metadata provider");
        }

    } catch (final ResolverException e) {
        throw new SAMLException("An error occured while getting IDP descriptors", e);
    }
    final SAMLMetadataContext mdCtx = parentContext.getSubcontext(SAMLMetadataContext.class, true);
    mdCtx.setEntityDescriptor(entityDescriptor);
    mdCtx.setRoleDescriptor(roleDescriptor);
}
 
开发者ID:yaochi,项目名称:pac4j-plus,代码行数:29,代码来源:SAML2ContextProvider.java

示例3: startAuthentication

import org.pac4j.core.util.CommonHelper; //导入方法依赖的package包/类
protected boolean startAuthentication(C context, List<Client> currentClients) {
    return CommonHelper.isNotEmpty(currentClients) && currentClients.get(0) instanceof IndirectClient;
}
 
开发者ID:e-gov,项目名称:TARA-Server,代码行数:4,代码来源:DefaultSecurityLogic.java


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