本文整理汇总了Java中org.opensaml.saml1.core.Audience类的典型用法代码示例。如果您正苦于以下问题:Java Audience类的具体用法?Java Audience怎么用?Java Audience使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Audience类属于org.opensaml.saml1.core包,在下文中一共展示了Audience类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newConditions
import org.opensaml.saml1.core.Audience; //导入依赖的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.Audience; //导入依赖的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.Audience; //导入依赖的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.Audience; //导入依赖的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: populateRequiredData
import org.opensaml.saml1.core.Audience; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
super.populateRequiredData();
Audience audience = (Audience) target;
audience.setUri("http://shibboleth.middleware.edu/");
}
示例6: testMissingUri
import org.opensaml.saml1.core.Audience; //导入依赖的package包/类
public void testMissingUri(){
Audience audience = (Audience) target;
audience.setUri(null);
assertValidationFail("Audience was null, should raise a Validation Exception");
audience.setUri("");
assertValidationFail("Audience was empty, should raise a Validation Exception");
audience.setUri(" ");
assertValidationFail("Audience was just spaces, should raise a Validation Exception");
}
示例7: AudienceTest
import org.opensaml.saml1.core.Audience; //导入依赖的package包/类
/**
* Constructor
*/
public AudienceTest() {
super();
singleElementFile = "/data/org/opensaml/saml1/impl/singleAudience.xml";
singleElementOptionalAttributesFile = "/data/org/opensaml/saml1/impl/singleAudienceAttributes.xml";
expectedUri = "urn:oasis:names:tc:SAML:1.0:assertion";
qname = new QName(SAMLConstants.SAML1_NS, Audience.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
}
示例8: validate
import org.opensaml.saml1.core.Audience; //导入依赖的package包/类
/** {@inheritDoc} */
public void validate(Audience audience) throws ValidationException {
validateURIPresent(audience);
}
示例9: validateURIPresent
import org.opensaml.saml1.core.Audience; //导入依赖的package包/类
protected void validateURIPresent(Audience audience) throws ValidationException {
if (DatatypeHelper.isEmpty(audience.getUri())) {
throw new ValidationException("AudienceURI Required");
}
}
示例10: marshallElementContent
import org.opensaml.saml1.core.Audience; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
Audience audience = (Audience) samlObject;
XMLHelper.appendTextContent(domElement, audience.getUri());
}
示例11: processElementContent
import org.opensaml.saml1.core.Audience; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processElementContent(XMLObject samlObject, String elementContent) {
Audience audience = (Audience) samlObject;
audience.setUri(elementContent);
}
示例12: getAudiences
import org.opensaml.saml1.core.Audience; //导入依赖的package包/类
/** {@inheritDoc} */
public List<Audience> getAudiences() {
return audiences;
}
示例13: buildObject
import org.opensaml.saml1.core.Audience; //导入依赖的package包/类
/** {@inheritDoc} */
public Audience buildObject() {
return buildObject(SAMLConstants.SAML1_NS, Audience.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML1_PREFIX);
}
示例14: AudienceMarshaller
import org.opensaml.saml1.core.Audience; //导入依赖的package包/类
/**
* Constructor
*/
public AudienceMarshaller() {
super(SAMLConstants.SAML1_NS, Audience.DEFAULT_ELEMENT_LOCAL_NAME);
}
示例15: marshallElementContent
import org.opensaml.saml1.core.Audience; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException {
Audience audience = (Audience) samlObject;
XMLHelper.appendTextContent(domElement,audience.getUri());
}