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


Java UsageType.equals方法代码示例

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


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

示例1: marshallAttributes

import org.opensaml.xml.security.credential.UsageType; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    KeyDescriptor keyDescriptor = (KeyDescriptor) xmlObject;

    if (keyDescriptor.getUse() != null) {
        UsageType use = keyDescriptor.getUse();
        // UsageType enum contains more values than are allowed by SAML 2 schema
        if (use.equals(UsageType.SIGNING) || use.equals(UsageType.ENCRYPTION)) {
            domElement.setAttribute(KeyDescriptor.USE_ATTRIB_NAME, use.toString().toLowerCase());
        } else if (use.equals(UsageType.UNSPECIFIED)) {
            // emit nothing for unspecified - this is semantically equivalent to non-existent attribute
        } else {
            // Just in case values are unknowingly added to UsageType in the future...
            throw new MarshallingException("KeyDescriptor had illegal value for use attribute: " + use.toString());
        }
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:KeyDescriptorMarshaller.java

示例2: marshallAttributes

import org.opensaml.xml.security.credential.UsageType; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    KeyDescriptor keyDescriptor = (KeyDescriptor) xmlObject;

    if (keyDescriptor.getUse() != null) {
        UsageType use = keyDescriptor.getUse();
        // UsageType enum contains more values than are allowed by SAML 2 schema 
        if (use.equals(UsageType.SIGNING) || use.equals(UsageType.ENCRYPTION)) {
            domElement.setAttribute(KeyDescriptor.USE_ATTRIB_NAME, use.toString().toLowerCase());
        } else if (use.equals(UsageType.UNSPECIFIED)) {
            //emit nothing for unspecified - this is semantically equivalent to non-existent attribute
        } else {
            // Just in case values are unknowingly added to UsageType in the future...
           throw new MarshallingException("KeyDescriptor had illegal value for use attribute: " + use.toString());
        }
    }
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:18,代码来源:KeyDescriptorMarshaller.java

示例3: validateUse

import org.opensaml.xml.security.credential.UsageType; //导入方法依赖的package包/类
/**
 * Checks that use attribute has only one of allowed values.
 * 
 * @param keyDescriptor the key descriptor to validate
 * @throws ValidationException throw in use attribute does not have a legal value
 */
protected void validateUse(KeyDescriptor keyDescriptor) throws ValidationException {
    UsageType use = keyDescriptor.getUse();
    if (use == null) {
        return;
    }
    if (       ! use.equals(UsageType.SIGNING) 
            && ! use.equals(UsageType.ENCRYPTION) 
            && ! use.equals(UsageType.UNSPECIFIED) ) {
        throw new ValidationException("Invalid value for use attribute: " + use.toString());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:KeyDescriptorSchemaValidator.java


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