private AttributeConsumingServiceType getAttributeConsumerService() { try { Handler attributeHandler = MetadataProviderUtils.getHandler(picketLinkType, "org.picketlink.identity.federation.web.handlers.saml2.SAML2AttributeHandler"); List<KeyValueType> options = attributeHandler.getOption(); ArrayList<String> attributeVals = new ArrayList<String>(); for(KeyValueType option:options) if (option.getKey().equals(ATTRIBUTE_KEYS)){ for(String str:option.getValue().split(",")) attributeVals.add(str); } AttributeConsumingServiceType attributeConsumingService = new AttributeConsumingServiceType(0); for(String attributeVal:attributeVals){ RequestedAttributeType requestedAttributeType = new RequestedAttributeType(attributeVal); requestedAttributeType.setIsRequired(true); requestedAttributeType.setNameFormat(JBossSAMLURIConstants.ATTRIBUTE_FORMAT_BASIC.get()); attributeConsumingService.addRequestedAttribute(requestedAttributeType); } LocalizedNameType serviceLocName = new LocalizedNameType(JBossSAMLConstants.LANG_EN.get()); serviceLocName.setValue(serviceName); attributeConsumingService.addServiceName(serviceLocName); attributeConsumingService.setIsDefault(true); return attributeConsumingService; } catch (ParsingException e) { throw new RuntimeException(e); } }
private AttributeConsumingServiceType getAttributeConsumerService() { try { Handler attributeHandler = MetadataProviderUtils.getHandler(picketLinkType, "org.picketlink.identity.federation.web.handlers.saml2.SAML2AttributeHandler"); List<KeyValueType> options = attributeHandler.getOption(); ArrayList<String> attributeVals = new ArrayList<String>(); for(KeyValueType option:options) if (option.getKey().equals(ATTRIBUTE_KEYS)){ for(String str:option.getValue().split(",")) attributeVals.add(str); } AttributeConsumingServiceType attributeConsumingService = new AttributeConsumingServiceType(0); for(String attributeVal:attributeVals){ RequestedAttributeType requestedAttributeType = new RequestedAttributeType(attributeVal); requestedAttributeType.setIsRequired(true); requestedAttributeType.setNameFormat(JBossSAMLURIConstants.ATTRIBUTE_FORMAT_BASIC.get()); attributeConsumingService.addRequestedAttribute(requestedAttributeType); } LocalizedNameType serviceLocName = new LocalizedNameType(JBossSAMLConstants.LANG_EN.get()); serviceLocName.setValue(serviceName); attributeConsumingService.addServiceName(serviceLocName); attributeConsumingService.setIsDefault(true); return attributeConsumingService; } catch (ParsingException e) { throw new RuntimeException(e); } }