本文整理汇总了Java中org.opensaml.saml2.metadata.EntityDescriptor.getValidUntil方法的典型用法代码示例。如果您正苦于以下问题:Java EntityDescriptor.getValidUntil方法的具体用法?Java EntityDescriptor.getValidUntil怎么用?Java EntityDescriptor.getValidUntil使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opensaml.saml2.metadata.EntityDescriptor
的用法示例。
在下文中一共展示了EntityDescriptor.getValidUntil方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSingleElementOptionalAttributesUnmarshall
import org.opensaml.saml2.metadata.EntityDescriptor; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementOptionalAttributesUnmarshall() {
EntityDescriptor descriptor = (EntityDescriptor) unmarshallElement(singleElementOptionalAttributesFile);
String entityID = descriptor.getEntityID();
assertEquals("entityID attribute has a value of " + entityID + ", expected a value of " + expectedEntityID,
expectedEntityID, entityID);
String id = descriptor.getID();
assertEquals("ID attribute has a value of " + id + ", expected a value of " + expectedID, expectedID, id);
long duration = descriptor.getCacheDuration().longValue();
assertEquals("cacheDuration attribute has a value of " + duration + ", expected a value of "
+ expectedCacheDuration, expectedCacheDuration, duration);
DateTime validUntil = descriptor.getValidUntil();
assertEquals("validUntil attribute value did not match expected value", 0, expectedValidUntil
.compareTo(validUntil));
}
示例2: validateRoot
import org.opensaml.saml2.metadata.EntityDescriptor; //导入方法依赖的package包/类
/**
* Checks that at least either Valid Until or Cache Duration is present when Entity Descriptor is root element.
*
* @param entityDescriptor
* @throws ValidationException
*/
protected void validateRoot(EntityDescriptor entityDescriptor) throws ValidationException {
if (entityDescriptor.getParent() == null && entityDescriptor.getValidUntil() == null
&& entityDescriptor.getCacheDuration() == null) {
throw new ValidationException("Must have either ValidUntil or CacheDuration when is root element.");
}
}
示例3: marshallAttributes
import org.opensaml.saml2.metadata.EntityDescriptor; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlElement, Element domElement) {
EntityDescriptor entityDescriptor = (EntityDescriptor) samlElement;
// Set the entityID attribute
if (entityDescriptor.getEntityID() != null) {
domElement.setAttributeNS(null, EntityDescriptor.ENTITY_ID_ATTRIB_NAME, entityDescriptor.getEntityID());
}
// Set the ID attribute
if (entityDescriptor.getID() != null) {
domElement.setAttributeNS(null, EntityDescriptor.ID_ATTRIB_NAME, entityDescriptor.getID());
domElement.setIdAttributeNS(null, EntityDescriptor.ID_ATTRIB_NAME, true);
}
// Set the validUntil attribute
if (entityDescriptor.getValidUntil() != null) {
log.debug("Writting validUntil attribute to EntityDescriptor DOM element");
String validUntilStr = Configuration.getSAMLDateFormatter().print(entityDescriptor.getValidUntil());
domElement.setAttributeNS(null, TimeBoundSAMLObject.VALID_UNTIL_ATTRIB_NAME, validUntilStr);
}
// Set the cacheDuration attribute
if (entityDescriptor.getCacheDuration() != null) {
log.debug("Writting cacheDuration attribute to EntityDescriptor DOM element");
String cacheDuration = XMLHelper.longToDuration(entityDescriptor.getCacheDuration());
domElement.setAttributeNS(null, CacheableSAMLObject.CACHE_DURATION_ATTRIB_NAME, cacheDuration);
}
Attr attribute;
for (Entry<QName, String> entry : entityDescriptor.getUnknownAttributes().entrySet()) {
attribute = XMLHelper.constructAttribute(domElement.getOwnerDocument(), entry.getKey());
attribute.setValue(entry.getValue());
domElement.setAttributeNodeNS(attribute);
if (Configuration.isIDAttribute(entry.getKey())
|| entityDescriptor.getUnknownAttributes().isIDAttribute(entry.getKey())) {
attribute.getOwnerElement().setIdAttributeNode(attribute, true);
}
}
}
示例4: testSingleElementUnmarshall
import org.opensaml.saml2.metadata.EntityDescriptor; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void testSingleElementUnmarshall() {
EntityDescriptor descriptor = (EntityDescriptor) unmarshallElement(singleElementFile);
String entityID = descriptor.getEntityID();
assertEquals("entityID attribute has a value of " + entityID + ", expected a value of " + expectedEntityID,
expectedEntityID, entityID);
Long duration = descriptor.getCacheDuration();
assertNull("cacheDuration attribute has a value of " + duration + ", expected no value", duration);
DateTime validUntil = descriptor.getValidUntil();
assertNull("validUntil attribute has a value of " + validUntil + ", expected no value", validUntil);
}