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


Java CriteriaSet.get方法代码示例

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


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

示例1: checkCriteriaRequirements

import org.opensaml.xml.security.CriteriaSet; //导入方法依赖的package包/类
/**
 * Check that all necessary credential criteria are available.
 * 
 * @param criteriaSet the credential set to evaluate
 */
protected void checkCriteriaRequirements(CriteriaSet criteriaSet) {
    EntityIDCriteria entityCriteria = criteriaSet.get(EntityIDCriteria.class);
    MetadataCriteria mdCriteria = criteriaSet.get(MetadataCriteria.class);
    if (entityCriteria == null) {
        throw new IllegalArgumentException("Entity criteria must be supplied");
    }
    if (mdCriteria == null) {
        throw new IllegalArgumentException("SAML metadata criteria must be supplied");
    }
    if (DatatypeHelper.isEmpty(entityCriteria.getEntityID())) {
        throw new IllegalArgumentException("Credential owner entity ID criteria value must be supplied");
    }
    if (mdCriteria.getRole() == null) {
        throw new IllegalArgumentException("Credential metadata role criteria value must be supplied");
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:MetadataCredentialResolver.java

示例2: resolveFromSource

import org.opensaml.xml.security.CriteriaSet; //导入方法依赖的package包/类
@Override
public Iterable<Credential> resolveFromSource(CriteriaSet criteriaSet) throws SecurityException {
    try {
        credentialSet = new HashSet<Credential>();
        Enumeration<String> en = keyStore.aliases();
        while (en.hasMoreElements()) {
            String alias = en.nextElement();
            X509Certificate cert = (X509Certificate) keyStore.getCertificate(alias);
            Credential credential = new X509CredentialImpl(cert);
            if (criteriaSet.get(EntityIDCriteria.class) != null) {
                if (criteriaSet.get(EntityIDCriteria.class).getEntityID().equals(alias)) {
                    credentialSet.add(credential);
                    break;
                }
            } else {
                credentialSet.add(credential);
            }
        }
        return credentialSet;
    } catch (KeyStoreException e) {
        log.error(e);
        throw new SecurityException("Error reading certificates from key store");
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:25,代码来源:CarbonKeyStoreCredentialResolver.java

示例3: resolveFromSource

import org.opensaml.xml.security.CriteriaSet; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected Iterable<Credential> resolveFromSource(CriteriaSet criteriaSet) throws SecurityException {
    KeyInfoCriteria kiCriteria = criteriaSet.get(KeyInfoCriteria.class);
    if (kiCriteria == null) {
        log.error("No KeyInfo criteria supplied, resolver could not process");
        throw new SecurityException("Credential criteria set did not contain an instance of"
                + "KeyInfoCredentialCriteria");
    }
    KeyInfo keyInfo = kiCriteria.getKeyInfo();

    // This will be the list of credentials to return.
    List<Credential> credentials = new ArrayList<Credential>();

    KeyInfoResolutionContext kiContext = new KeyInfoResolutionContext(credentials);

    // Note: we allow KeyInfo to be null to handle case where application context,
    // other accompanying criteria, etc, should be used to resolve credentials via hooks below.
    if (keyInfo != null) {
        processKeyInfo(keyInfo, kiContext, criteriaSet, credentials);
    } else {
        log.info("KeyInfo was null, any credentials will be resolved by post-processing hooks only");
    }

    // Postprocessing hook
    postProcess(kiContext, criteriaSet, credentials);

    // Final empty credential hook
    if (credentials.isEmpty()) {
        log.debug("No credentials were found, calling empty credentials post-processing hook");
        postProcessEmptyCredentials(kiContext, criteriaSet, credentials);
    }

    log.debug("A total of {} credentials were resolved", credentials.size());
    return credentials;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:BasicProviderKeyInfoCredentialResolver.java

示例4: checkCriteriaRequirements

import org.opensaml.xml.security.CriteriaSet; //导入方法依赖的package包/类
/**
 * Check that required credential criteria are available.
 * 
 * @param criteriaSet the credential criteria set to evaluate
 */
protected void checkCriteriaRequirements(CriteriaSet criteriaSet) {
    EntityIDCriteria entityCriteria = criteriaSet.get(EntityIDCriteria.class);
    if (entityCriteria == null) {
        log.error("EntityIDCriteria was not specified in the criteria set, resolution can not be attempted");
        throw new IllegalArgumentException("No EntityIDCriteria was available in criteria set");
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:KeyStoreCredentialResolver.java

示例5: resolveFromSource

import org.opensaml.xml.security.CriteriaSet; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected Iterable<Credential> resolveFromSource(CriteriaSet criteriaSet) throws SecurityException {

    checkCriteriaRequirements(criteriaSet);

    String entityID = criteriaSet.get(EntityIDCriteria.class).getEntityID();
    MetadataCriteria mdCriteria = criteriaSet.get(MetadataCriteria.class);
    QName role = mdCriteria.getRole();
    String protocol = mdCriteria.getProtocol();
    UsageCriteria usageCriteria = criteriaSet.get(UsageCriteria.class);
    UsageType usage = null;
    if (usageCriteria != null) {
        usage = usageCriteria.getUsage();
    } else {
        usage = UsageType.UNSPECIFIED;
    }
    
    // See Jira issue SIDP-229.
    log.debug("Forcing on-demand metadata provider refresh if necessary");
    try {
        metadata.getMetadata();
    } catch (MetadataProviderException e) {
        // don't care about errors at this level
    }

    MetadataCacheKey cacheKey = new MetadataCacheKey(entityID, role, protocol, usage);
    Collection<Credential> credentials = retrieveFromCache(cacheKey);

    if (credentials == null) {
        credentials = retrieveFromMetadata(entityID, role, protocol, usage);
        cacheCredentials(cacheKey, credentials);
    }

    return credentials;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:36,代码来源:MetadataCredentialResolver.java

示例6: resolveFromSource

import org.opensaml.xml.security.CriteriaSet; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected Iterable<Credential> resolveFromSource(CriteriaSet criteriaSet) throws SecurityException {

    checkCriteriaRequirements(criteriaSet);

    String entityID = criteriaSet.get(EntityIDCriteria.class).getEntityID();
    MetadataCriteria mdCriteria = criteriaSet.get(MetadataCriteria.class);
    QName role = mdCriteria.getRole();
    String protocol = mdCriteria.getProtocol();
    UsageCriteria usageCriteria = criteriaSet.get(UsageCriteria.class);
    UsageType usage = null;
    if (usageCriteria != null) {
        usage = usageCriteria.getUsage();
    } else {
        usage = UsageType.UNSPECIFIED;
    }

    MetadataCacheKey cacheKey = new MetadataCacheKey(entityID, role, protocol, usage);
    Collection<Credential> credentials = retrieveFromCache(cacheKey);

    if (credentials == null) {
        credentials = retrieveFromMetadata(entityID, role, protocol, usage);
        cacheCredentials(cacheKey, credentials);
    }

    return credentials;
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:28,代码来源:MetadataCredentialResolver.java

示例7: process

import org.opensaml.xml.security.CriteriaSet; //导入方法依赖的package包/类
/** {@inheritDoc} */
public Collection<Credential> process(KeyInfoCredentialResolver resolver, XMLObject keyInfoChild, 
        CriteriaSet criteriaSet, KeyInfoResolutionContext kiContext) throws SecurityException {
    
    DSAKeyValue keyValue = getDSAKeyValue(keyInfoChild);
    if (keyValue == null) {
        return null;
    }
    
    KeyAlgorithmCriteria algorithmCriteria = criteriaSet.get(KeyAlgorithmCriteria.class);
    if (algorithmCriteria != null 
            && algorithmCriteria.getKeyAlgorithm() != null 
            && ! algorithmCriteria.getKeyAlgorithm().equals("DSA")) {
        log.debug("Criteria specified non-DSA key algorithm, skipping");
        return null;
    }
    
    log.debug("Attempting to extract credential from a DSAKeyValue");
    
    PublicKey pubKey = null;
    try {
        //TODO deal with case of incomplete DSAParams, need hook to resolve those
        pubKey = KeyInfoHelper.getDSAKey(keyValue);
    } catch (KeyException e) {
        log.error("Error extracting DSA key value", e);
        throw new SecurityException("Error extracting DSA key value", e);
    }
    BasicCredential cred = new BasicCredential();
    cred.setPublicKey(pubKey);
    if (kiContext != null) {
        cred.getKeyNames().addAll(kiContext.getKeyNames());
    }
    
    CredentialContext credContext = buildCredentialContext(kiContext);
    if (credContext != null) {
        cred.getCredentalContextSet().add(credContext);
    }
    
    log.debug("Credential successfully extracted from DSAKeyValue");
    LazySet<Credential> credentialSet = new LazySet<Credential>();
    credentialSet.add(cred);
    return credentialSet;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:44,代码来源:DSAKeyValueProvider.java

示例8: process

import org.opensaml.xml.security.CriteriaSet; //导入方法依赖的package包/类
/** {@inheritDoc} */
public Collection<Credential> process(KeyInfoCredentialResolver resolver, XMLObject keyInfoChild,
        CriteriaSet criteriaSet, KeyInfoResolutionContext kiContext) throws SecurityException {

    DEREncodedKeyValue keyValue = getDEREncodedKeyValue(keyInfoChild);
    if (keyValue == null) {
        return null;
    }

    log.debug("Attempting to extract credential from a DEREncodedKeyValue");
    
    PublicKey pubKey = null;
    try {
        pubKey = KeyInfoHelper.getKey(keyValue);
    } catch (KeyException e) {
        log.error("Error extracting DER-encoded key value", e);
        throw new SecurityException("Error extracting DER-encoded key value", e);
    }
    
    KeyAlgorithmCriteria algorithmCriteria = criteriaSet.get(KeyAlgorithmCriteria.class);
    if (algorithmCriteria != null && algorithmCriteria.getKeyAlgorithm() != null
            && !algorithmCriteria.getKeyAlgorithm().equals(pubKey.getAlgorithm())) {
        log.debug("Criteria specified key algorithm {}, actually {}, skipping",
                algorithmCriteria.getKeyAlgorithm(), pubKey.getAlgorithm());
        return null;
    }

    BasicCredential cred = new BasicCredential();
    cred.setPublicKey(pubKey);
    if (kiContext != null) {
        cred.getKeyNames().addAll(kiContext.getKeyNames());
    }
    
    CredentialContext credContext = buildCredentialContext(kiContext);
    if (credContext != null) {
        cred.getCredentalContextSet().add(credContext);
    }

    log.debug("Credential successfully extracted from DEREncodedKeyValue");
    LazySet<Credential> credentialSet = new LazySet<Credential>();
    credentialSet.add(cred);
    return credentialSet;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:44,代码来源:DEREncodedKeyValueProvider.java

示例9: process

import org.opensaml.xml.security.CriteriaSet; //导入方法依赖的package包/类
/** {@inheritDoc} */
public Collection<Credential> process(KeyInfoCredentialResolver resolver, XMLObject keyInfoChild,
        CriteriaSet criteriaSet, KeyInfoResolutionContext kiContext) throws SecurityException {

    RSAKeyValue keyValue = getRSAKeyValue(keyInfoChild);
    if (keyValue == null) {
        return null;
    }

    KeyAlgorithmCriteria algorithmCriteria = criteriaSet.get(KeyAlgorithmCriteria.class);
    if (algorithmCriteria != null && algorithmCriteria.getKeyAlgorithm() != null
            && !algorithmCriteria.getKeyAlgorithm().equals("RSA")) {
        log.debug("Criteria specified non-RSA key algorithm, skipping");
        return null;
    }

    log.debug("Attempting to extract credential from an RSAKeyValue");

    PublicKey pubKey = null;
    try {
        pubKey = KeyInfoHelper.getRSAKey(keyValue);
    } catch (KeyException e) {
        log.error("Error extracting RSA key value", e);
        throw new SecurityException("Error extracting RSA key value", e);
    }
    BasicCredential cred = new BasicCredential();
    cred.setPublicKey(pubKey);
    if (kiContext != null) {
        cred.getKeyNames().addAll(kiContext.getKeyNames());
    }

    CredentialContext credContext = buildCredentialContext(kiContext);
    if (credContext != null) {
        cred.getCredentalContextSet().add(credContext);
    }

    log.debug("Credential successfully extracted from RSAKeyValue");
    LazySet<Credential> credentialSet = new LazySet<Credential>();
    credentialSet.add(cred);
    return credentialSet;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:42,代码来源:RSAKeyValueProvider.java


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