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


Java EntityDescriptor.getCacheDuration方法代码示例

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


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

示例1: 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.");
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:EntityDescriptorSpecValidator.java

示例2: 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);
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:41,代码来源:EntityDescriptorMarshaller.java

示例3: 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);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:15,代码来源:EntityDescriptorTest.java


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