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


Java AttributeConsumingService类代码示例

本文整理汇总了Java中org.opensaml.saml2.metadata.AttributeConsumingService的典型用法代码示例。如果您正苦于以下问题:Java AttributeConsumingService类的具体用法?Java AttributeConsumingService怎么用?Java AttributeConsumingService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: selectService

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/**
 * Select the AttributeConsumingService.
 * 
 * @return the selected AttributeConsumingService, or null
 */
public AttributeConsumingService selectService() {
    List<AttributeConsumingService> candidates = getCandidates();

    if (candidates == null || candidates.isEmpty()) {
        log.debug("AttributeConsumingService candidate list was empty, can not select service");
        return null;
    }

    log.debug("AttributeConsumingService index was specified: {}", index != null);

    AttributeConsumingService acs = null;
    if (index != null) {
        acs = selectByIndex(candidates);
        if (acs == null && isOnBadIndexUseDefault()) {
            acs = selectDefault(candidates);
        }
    } else {
        return selectDefault(candidates);
    }

    return acs;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:28,代码来源:AttributeConsumingServiceSelector.java

示例2: selectByIndex

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/**
 * Select the service based on the index value.
 * 
 * @param candidates the list of candiate services
 * @return the selected candidate or null
 */
private AttributeConsumingService selectByIndex(List<AttributeConsumingService> candidates) {
    log.debug("Selecting AttributeConsumingService by index");
    for (AttributeConsumingService attribCS : candidates) {
        // Check for null b/c don't ever want to fail with an NPE due to autoboxing.
        // Note: metadata index property is an int, not an Integer.
        if (index != null) {
            if (index == attribCS.getIndex()) {
                log.debug("Selected AttributeConsumingService with index: {}", index);
                return attribCS;
            }
        }
    }
    log.debug("A service index of '{}' was specified, but was not found in metadata", index);
    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:AttributeConsumingServiceSelector.java

示例3: selectDefault

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/**
 * Select the default service.
 * 
 * @param candidates the list of candiate services
 * @return the selected candidate or null
 */
private AttributeConsumingService selectDefault(List<AttributeConsumingService> candidates) {
    log.debug("Selecting default AttributeConsumingService");
    AttributeConsumingService firstNoDefault = null;
    for (AttributeConsumingService attribCS : candidates) {
        if (attribCS.isDefault()) {
            log.debug("Selected AttributeConsumingService with explicit isDefault of true");
            return attribCS;
        }

        // This records the first element whose isDefault is not explicitly false
        if (firstNoDefault == null && attribCS.isDefaultXSBoolean() == null) {
            firstNoDefault = attribCS;
        }
    }

    if (firstNoDefault != null) {
        log.debug("Selected first AttributeConsumingService with no explicit isDefault");
        return firstNoDefault;
    } else {
        log.debug("Selected first AttributeConsumingService with explicit isDefault of false");
        return candidates.get(0);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:AttributeConsumingServiceSelector.java

示例4: testChildElementsMarshall

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
public void testChildElementsMarshall()
{
    QName qname = new QName(SAMLConstants.SAML20MD_NS, AttributeConsumingService.DEFAULT_ELEMENT_LOCAL_NAME);
    AttributeConsumingService service = (AttributeConsumingService) buildXMLObject(qname);
    
    service.setIndex(expectedIndex);
    
    QName serviceNameQName = new QName(SAMLConstants.SAML20MD_NS, ServiceName.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX);
    for (int i = 0; i < expectedServiceNameCount; i++) {
        service.getNames().add((ServiceName) buildXMLObject(serviceNameQName));
    }

    QName serviceDescQName = new QName(SAMLConstants.SAML20MD_NS, ServiceDescription.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX);
    for (int i = 0; i < expectedServiceDecsriptionCount; i++) {
        service.getDescriptions().add((ServiceDescription) buildXMLObject(serviceDescQName));
    }

    service.getRequestAttributes().add((RequestedAttribute) buildXMLObject(RequestedAttribute.DEFAULT_ELEMENT_NAME));

    assertEquals(expectedChildElementsDOM, service);

}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:23,代码来源:AttributeConsumingServiceTest.java

示例5: testXSBooleanAttributes

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/**
 * Test the proper behavior of the XSBooleanValue attributes.
 */
public void testXSBooleanAttributes() {
    AttributeConsumingService acs = 
        (AttributeConsumingService) buildXMLObject(AttributeConsumingService.DEFAULT_ELEMENT_NAME);
    
    // isDefault attribute
    acs.setIsDefault(Boolean.TRUE);
    assertEquals("Unexpected value for boolean attribute found", Boolean.TRUE, acs.isDefault());
    assertNotNull("XSBooleanValue was null", acs.isDefaultXSBoolean());
    assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.TRUE, false),
            acs.isDefaultXSBoolean());
    assertEquals("XSBooleanValue string was unexpected value", "true", acs.isDefaultXSBoolean().toString());
    
    acs.setIsDefault(Boolean.FALSE);
    assertEquals("Unexpected value for boolean attribute found", Boolean.FALSE, acs.isDefault());
    assertNotNull("XSBooleanValue was null", acs.isDefaultXSBoolean());
    assertEquals("XSBooleanValue was unexpected value", new XSBooleanValue(Boolean.FALSE, false),
            acs.isDefaultXSBoolean());
    assertEquals("XSBooleanValue string was unexpected value", "false", acs.isDefaultXSBoolean().toString());
    
    acs.setIsDefault((Boolean) null);
    assertEquals("Unexpected default value for boolean attribute found", Boolean.FALSE, acs.isDefault());
    assertNull("XSBooleanValue was not null", acs.isDefaultXSBoolean());
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:27,代码来源:AttributeConsumingServiceTest.java

示例6: processChildElement

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    AttributeQueryDescriptorType descriptor = (AttributeQueryDescriptorType) parentSAMLObject;

    if (childSAMLObject instanceof AttributeConsumingService) {
        descriptor.getAttributeConsumingServices().add((AttributeConsumingService) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:AttributeQueryDescriptorTypeUnmarshaller.java

示例7: validateRequestedAttributes

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/**
 * Checks that one or more Requested Attributes are present.
 * 
 * @param attributeConsumingService
 * @throws ValidationException
 */
protected void validateRequestedAttributes(AttributeConsumingService attributeConsumingService)
        throws ValidationException {
    if (attributeConsumingService.getRequestAttributes() == null
            || attributeConsumingService.getRequestAttributes().size() == 0) {
        throw new ValidationException("Must have one or more Requested Attributes.");
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:AttributeConsumingServiceSchemaValidator.java

示例8: processChildElement

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    AttributeConsumingService service = (AttributeConsumingService) parentSAMLObject;

    if (childSAMLObject instanceof ServiceName) {
        service.getNames().add((ServiceName) childSAMLObject);
    } else if (childSAMLObject instanceof ServiceDescription) {
        service.getDescriptions().add((ServiceDescription) childSAMLObject);
    } else if (childSAMLObject instanceof RequestedAttribute) {
        service.getRequestAttributes().add((RequestedAttribute) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:AttributeConsumingServiceUnmarshaller.java

示例9: processAttribute

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException {
    AttributeConsumingService service = (AttributeConsumingService) samlObject;

    if (attribute.getLocalName().equals(AttributeConsumingService.INDEX_ATTRIB_NAME)) {
        service.setIndex(Integer.valueOf(attribute.getValue()));
    } else if (attribute.getLocalName().equals(AttributeConsumingService.IS_DEFAULT_ATTRIB_NAME)) {
        service.setIsDefault(XSBooleanValue.valueOf(attribute.getValue()));
    } else {
        super.processAttribute(samlObject, attribute);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:AttributeConsumingServiceUnmarshaller.java

示例10: marshallAttributes

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
    AttributeConsumingService service = (AttributeConsumingService) samlObject;

    domElement.setAttributeNS(null, AttributeConsumingService.INDEX_ATTRIB_NAME, Integer.toString(service
            .getIndex()));

    if (service.isDefaultXSBoolean() != null) {
        domElement.setAttributeNS(null, AttributeConsumingService.IS_DEFAULT_ATTRIB_NAME, service
                .isDefaultXSBoolean().toString());
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:AttributeConsumingServiceMarshaller.java

示例11: processChildElement

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/** {@inheritDoc} */
protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject)
        throws UnmarshallingException {
    SPSSODescriptor descriptor = (SPSSODescriptor) parentSAMLObject;

    if (childSAMLObject instanceof AssertionConsumerService) {
        descriptor.getAssertionConsumerServices().add((AssertionConsumerService) childSAMLObject);
    } else if (childSAMLObject instanceof AttributeConsumingService) {
        descriptor.getAttributeConsumingServices().add((AttributeConsumingService) childSAMLObject);
    } else {
        super.processChildElement(parentSAMLObject, childSAMLObject);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:SPSSODescriptorUnmarshaller.java

示例12: createAttributeConsumingService

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
public static AttributeConsumingService createAttributeConsumingService(String serviceName) {
	AttributeConsumingService service = SAMLUtil.buildXMLObject(AttributeConsumingService.class);
	ServiceName name = SAMLUtil.buildXMLObject(ServiceName.class);
	name.setName(new LocalizedString(serviceName, "en"));
	service.getNames().add(name);
	
	service.setIndex(0);
	service.setIsDefault(true);

	return service;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:12,代码来源:SAMLUtil.java

示例13: getDefaultAttributeConsumingService

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/** {@inheritDoc} */
public AttributeConsumingService getDefaultAttributeConsumingService(){
    for(AttributeConsumingService service : attributeConsumingServices){
        if(service.isDefault()){
            return service;
        }
    }
    
    return null;
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:11,代码来源:SPSSODescriptorImpl.java

示例14: marshallAttributes

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException {
    AttributeConsumingService service = (AttributeConsumingService) samlObject;

    domElement.setAttributeNS(null, AttributeConsumingService.INDEX_ATTRIB_NAME, Integer.toString(service
            .getIndex()));

    if (service.isDefaultXSBoolean() != null) {
        domElement.setAttributeNS(null, AttributeConsumingService.IS_DEFAULT_ATTRIB_NAME,
                service.isDefaultXSBoolean().toString());
    }
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:13,代码来源:AttributeConsumingServiceMarshaller.java

示例15: populateRequiredData

import org.opensaml.saml2.metadata.AttributeConsumingService; //导入依赖的package包/类
/** {@inheritDoc} */
protected void populateRequiredData() {
    super.populateRequiredData();
    SPSSODescriptor spssoDescriptor = (SPSSODescriptor) target;
    AttributeConsumingService attributeConsumingService = (AttributeConsumingService) buildXMLObject(new QName(SAMLConstants.SAML20MD_NS,
            AttributeConsumingService.DEFAULT_ELEMENT_LOCAL_NAME, SAMLConstants.SAML20MD_PREFIX));
    spssoDescriptor.getAttributeConsumingServices().add(attributeConsumingService);
}
 
开发者ID:apigee,项目名称:java-opensaml2,代码行数:9,代码来源:SPSSODescriptorSchemaTest.java


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