本文整理汇总了Java中org.opensaml.security.MetadataCriteria类的典型用法代码示例。如果您正苦于以下问题:Java MetadataCriteria类的具体用法?Java MetadataCriteria怎么用?Java MetadataCriteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MetadataCriteria类属于org.opensaml.security包,在下文中一共展示了MetadataCriteria类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildCriteriaSet
import org.opensaml.security.MetadataCriteria; //导入依赖的package包/类
/** {@inheritDoc} */
protected CriteriaSet buildCriteriaSet(String entityID, MessageContext messageContext)
throws SecurityPolicyException {
if (!(messageContext instanceof SAMLMessageContext)) {
log.error("Supplied message context was not an instance of SAMLMessageContext, can not build criteria set from SAML metadata parameters");
throw new SecurityPolicyException("Supplied message context was not an instance of SAMLMessageContext");
}
SAMLMessageContext samlContext = (SAMLMessageContext) messageContext;
CriteriaSet criteriaSet = new CriteriaSet();
if (! DatatypeHelper.isEmpty(entityID)) {
criteriaSet.add(new EntityIDCriteria(entityID) );
}
MetadataCriteria mdCriteria =
new MetadataCriteria(samlContext.getPeerEntityRole(), samlContext.getInboundSAMLProtocol());
criteriaSet.add(mdCriteria);
criteriaSet.add( new UsageCriteria(UsageType.SIGNING) );
return criteriaSet;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:BaseSAMLXMLSignatureSecurityPolicyRule.java
示例2: buildCriteriaSet
import org.opensaml.security.MetadataCriteria; //导入依赖的package包/类
/**
* Build a criteria set suitable for input to the trust engine.
*
* @param entityID the candidate issuer entity ID which is being evaluated
* @param samlContext the message context which is being evaluated
* @return a newly constructly set of criteria suitable for the configured trust engine
* @throws SecurityPolicyException thrown if criteria set can not be constructed
*/
protected CriteriaSet buildCriteriaSet(String entityID, SAMLMessageContext samlContext)
throws SecurityPolicyException {
CriteriaSet criteriaSet = new CriteriaSet();
if (!DatatypeHelper.isEmpty(entityID)) {
criteriaSet.add(new EntityIDCriteria(entityID));
}
MetadataCriteria mdCriteria = new MetadataCriteria(samlContext.getPeerEntityRole(), samlContext
.getInboundSAMLProtocol());
criteriaSet.add(mdCriteria);
criteriaSet.add(new UsageCriteria(UsageType.SIGNING));
return criteriaSet;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:BaseSAMLSimpleSignatureSecurityPolicyRule.java
示例3: buildCriteriaSet
import org.opensaml.security.MetadataCriteria; //导入依赖的package包/类
/** {@inheritDoc} */
protected CriteriaSet buildCriteriaSet(String entityID, MessageContext messageContext)
throws SecurityPolicyException {
if (!(messageContext instanceof SAMLMessageContext)) {
log.error("Supplied message context was not an instance of SAMLMessageContext, can not build criteria set from SAML metadata parameters");
throw new SecurityPolicyException("Supplied message context was not an instance of SAMLMessageContext");
}
SAMLMessageContext samlContext = (SAMLMessageContext) messageContext;
CriteriaSet criteriaSet = super.buildCriteriaSet(entityID, messageContext);
MetadataCriteria mdCriteria =
new MetadataCriteria(samlContext.getPeerEntityRole(), samlContext.getInboundSAMLProtocol());
criteriaSet.add(mdCriteria);
return criteriaSet;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:19,代码来源:SAMLMDClientCertAuthRule.java
示例4: buildCriteriaSet
import org.opensaml.security.MetadataCriteria; //导入依赖的package包/类
/**
* Build a criteria set suitable for input to the trust engine.
*
* @param entityID the candidate issuer entity ID which is being evaluated
* @param samlContext the message context which is being evaluated
* @return a newly constructly set of criteria suitable for the configured trust engine
* @throws SecurityPolicyException thrown if criteria set can not be constructed
*/
protected CriteriaSet buildCriteriaSet(String entityID, SAMLMessageContext samlContext)
throws SecurityPolicyException {
CriteriaSet criteriaSet = new CriteriaSet();
if (!DatatypeHelper.isEmpty(entityID)) {
criteriaSet.add(new EntityIDCriteria(entityID));
}
MetadataCriteria mdCriteria = new MetadataCriteria(samlContext.getPeerEntityRole(), samlContext
.getInboundSAMLProtocol());
criteriaSet.add(mdCriteria);
criteriaSet.add(new UsageCriteria(UsageType.SIGNING));
return criteriaSet;
}
开发者ID:brainysmith,项目名称:idp-play-bridge,代码行数:25,代码来源:BaseSAMLSimpleSignatureSecurityPolicyRuleExtended.java
示例5: validateResponseSignature
import org.opensaml.security.MetadataCriteria; //导入依赖的package包/类
/**
* 09-03-2014(Milinda) - Copied from pac4j and modify to make it work in this code.
* @param samlResponse
* @param messageContext
* @throws Exception
*/
private void validateResponseSignature(Response samlResponse, SAMLMessageContext messageContext) throws Exception {
if (!samlResponse.isSigned()) {
return;
}
SAMLSignatureProfileValidator signatureProfileValidator = new SAMLSignatureProfileValidator();
try {
signatureProfileValidator.validate(samlResponse.getSignature());
} catch (ValidationException ve) {
log.error("SAML response contains invalid signature profile.");
throw new Exception("Invalid SAML response.", ve);
}
CriteriaSet criteriaSet = new CriteriaSet();
criteriaSet.add(new UsageCriteria(UsageType.SIGNING));
criteriaSet.add(new MetadataCriteria(IDPSSODescriptor.DEFAULT_ELEMENT_NAME, SAMLConstants.SAML20P_NS));
criteriaSet.add(new EntityIDCriteria(messageContext.getPeerEntityId()));
boolean valid;
try {
valid = trustEngine.validate(samlResponse.getSignature(), criteriaSet);
} catch (Exception e) {
throw new Exception("SAML response signature validation failed.", e);
}
if (!valid) {
log.error("Invalid signature in SAML response.");
throw new Exception("Invalid SAML response.");
}
messageContext.setInboundSAMLMessageAuthenticated(true);
}
开发者ID:milinda,项目名称:play-samlsso,代码行数:41,代码来源:SAMLResponseValidator.java
示例6: getSpCredentials
import org.opensaml.security.MetadataCriteria; //导入依赖的package包/类
public static Credential getSpCredentials() throws SecurityException {
MetadataCredentialResolverFactory credentialResolverFactory = MetadataCredentialResolverFactory.getFactory();
MetadataCredentialResolver credentialResolver = credentialResolverFactory.getInstance(spMetaDataProvider);
CriteriaSet criteriaSet = new CriteriaSet();
criteriaSet.add(new MetadataCriteria(SPSSODescriptor.DEFAULT_ELEMENT_NAME, SAMLConstants.SAML20P_NS));
criteriaSet.add(new EntityIDCriteria(MockIDPProperties.getSpEntityId()));
return credentialResolver.resolveSingle(criteriaSet);
}
开发者ID:rasmusson,项目名称:MockIDP,代码行数:11,代码来源:MockIDPSPMetadata.java
注:本文中的org.opensaml.security.MetadataCriteria类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论