本文整理汇总了Java中org.opensaml.saml1.core.AudienceRestrictionCondition类的典型用法代码示例。如果您正苦于以下问题:Java AudienceRestrictionCondition类的具体用法?Java AudienceRestrictionCondition怎么用?Java AudienceRestrictionCondition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AudienceRestrictionCondition类属于org.opensaml.saml1.core包,在下文中一共展示了AudienceRestrictionCondition类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newConditions
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
private Conditions newConditions(final DateTime issuedAt, final String serviceId) {
final Conditions conditions = newSamlObject(Conditions.class);
conditions.setNotBefore(issuedAt);
conditions.setNotOnOrAfter(issuedAt.plus(this.issueLength));
final AudienceRestrictionCondition audienceRestriction = newSamlObject(AudienceRestrictionCondition.class);
final Audience audience = newSamlObject(Audience.class);
audience.setUri(serviceId);
audienceRestriction.getAudiences().add(audience);
conditions.getAudienceRestrictionConditions().add(audienceRestriction);
return conditions;
}
示例2: processChildElement
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
throws UnmarshallingException {
AudienceRestrictionCondition audienceRestrictionCondition = (AudienceRestrictionCondition) parentSAMLObject;
if (childSAMLObject instanceof Audience) {
audienceRestrictionCondition.getAudiences().add((Audience) childSAMLObject);
} else {
super.processChildElement(parentSAMLObject, childSAMLObject);
}
}
示例3: createSAMLAssertion
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
@Override
public void createSAMLAssertion(DateTime notAfter, DateTime notBefore, String assertionId)
throws IdentityProviderException {
assertion = (Assertion) buildXMLObject(Assertion.DEFAULT_ELEMENT_NAME);
Conditions conditions = (Conditions) buildXMLObject(Conditions.DEFAULT_ELEMENT_NAME);
conditions.setNotBefore(notBefore);
conditions.setNotOnOrAfter(notAfter);
ServerConfiguration config = ServerConfiguration.getInstance();
String host = "http://" + config.getFirstProperty("HostName");
assertion.setIssuer(host);
assertion.setIssueInstant(new DateTime());
if (appilesTo != null) {
Audience audience = (Audience) buildXMLObject(Audience.DEFAULT_ELEMENT_NAME);
audience.setUri(appilesTo);
AudienceRestrictionCondition audienceRestrictions =
(AudienceRestrictionCondition) buildXMLObject(AudienceRestrictionCondition.DEFAULT_ELEMENT_NAME);
audienceRestrictions.getAudiences().add(audience);
conditions.getAudienceRestrictionConditions().add(audienceRestrictions);
}
assertion.setConditions(conditions);
assertion.getAttributeStatements().add(this.attributeStmt);
assertion.setID(assertionId);
}
示例4: populateRequiredData
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
super.populateRequiredData();
AudienceRestrictionCondition audienceRestrictionCondition = (AudienceRestrictionCondition) target;
QName name = new QName(SAMLConstants.SAML1_NS, Audience.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
audienceRestrictionCondition.getAudiences().add((Audience)buildXMLObject(name));
}
示例5: validate
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
/** {@inheritDoc} */
public void validate(AudienceRestrictionCondition audienceRestrictionCondition) throws ValidationException {
validateAudiences(audienceRestrictionCondition);
}
示例6: buildObject
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
/** {@inheritDoc} */
public AudienceRestrictionCondition buildObject() {
return buildObject(SAMLConstants.SAML1_NS, AudienceRestrictionCondition.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
}
示例7: getAudienceRestrictionConditions
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
/** {@inheritDoc} */
public List<AudienceRestrictionCondition> getAudienceRestrictionConditions() {
QName qname = new QName(SAMLConstants.SAML1_NS, AudienceRestrictionCondition.DEFAULT_ELEMENT_LOCAL_NAME);
return (List<AudienceRestrictionCondition>) conditions.subList(qname);
}
示例8: AudienceRestrictionConditionMarshaller
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
/**
* Constructor
*/
public AudienceRestrictionConditionMarshaller() {
super(SAMLConstants.SAML1_NS, AudienceRestrictionCondition.DEFAULT_ELEMENT_LOCAL_NAME);
}
示例9: AudienceRestrictionConditionUnmarshaller
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
/**
* Constructor
*/
public AudienceRestrictionConditionUnmarshaller() {
super(SAMLConstants.SAML1_NS, AudienceRestrictionCondition.DEFAULT_ELEMENT_LOCAL_NAME);
}
示例10: AudienceRestrictionConditionSchemaTest
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
/** Constructor */
public AudienceRestrictionConditionSchemaTest() {
super();
targetQName = new QName(SAMLConstants.SAML1_NS, AudienceRestrictionCondition.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
validator = new AudienceRestrictionConditionSchemaValidator();
}
示例11: testMissingAudience
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
public void testMissingAudience(){
AudienceRestrictionCondition audienceRestrictionCondition = (AudienceRestrictionCondition) target;
audienceRestrictionCondition.getAudiences().clear();
assertValidationFail("Audience was empty, should raise a Validation Exception");
}
示例12: testChildElementsMarshall
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
/** {@inheritDoc} */
public void testChildElementsMarshall() {
Conditions conditions = (Conditions) buildXMLObject(qname);
QName arcQname = new QName(SAMLConstants.SAML1_NS, AudienceRestrictionCondition.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
conditions.getConditions().add((AudienceRestrictionCondition) buildXMLObject(arcQname));
conditions.getConditions().add((DoNotCacheCondition) buildXMLObject(new QName(SAMLConstants.SAML1_NS, DoNotCacheCondition.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX)));
// conditions.addCondition(condition);
conditions.getConditions().add((AudienceRestrictionCondition) buildXMLObject(arcQname));
// conditions.addCondition(condition);
//
conditions.getConditions().add((AudienceRestrictionCondition) buildXMLObject(arcQname));
assertEquals(expectedChildElementsDOM, conditions);
}
示例13: AudienceRestrictionConditionTest
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
/**
* Constructor
*/
public AudienceRestrictionConditionTest() {
singleElementFile = "/data/org/opensaml/saml1/impl/singleAudienceRestrictionCondition.xml";
childElementsFile = "/data/org/opensaml/saml1/impl/AudienceRestrictionConditionWithChildren.xml";
qname = new QName(SAMLConstants.SAML1_NS, AudienceRestrictionCondition.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
}
示例14: validateAudiences
import org.opensaml.saml1.core.AudienceRestrictionCondition; //导入依赖的package包/类
/**
* Validates that the condition specifies at least one audience.
*
* @param audienceRestrictionCondition condition to validate
*
* @throws ValidationException thrown if now audience is specified in the condition
*/
protected void validateAudiences(AudienceRestrictionCondition audienceRestrictionCondition) throws ValidationException{
if (audienceRestrictionCondition.getAudiences() == null ||
audienceRestrictionCondition.getAudiences().size() == 0) {
throw new ValidationException("No Audience statements present");
}
}