-/*
- * Copyright 2009-2010 Internet2
+/**
+ * Licensed to the University Corporation for Advanced Internet
+ * Development, Inc. (UCAID) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for
+ * additional information regarding copyright ownership.
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * UCAID licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except
+ * in compliance with the License. You may obtain a copy of the
+ * License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific
+ * language governing permissions and limitations under the License.
*/
/**
#include "saml2/metadata/Metadata.h"
#include "saml2/metadata/MetadataFilter.h"
+#include <boost/ptr_container/ptr_set.hpp>
#include <xmltooling/logging.h>
#include <xmltooling/util/NDC.h>
using namespace opensaml::saml2md;
using namespace xmltooling::logging;
using namespace xmltooling;
+using namespace boost;
using namespace std;
namespace opensaml {
void doFilter(EntitiesDescriptor& entities) const;
bool m_removeRolelessEntityDescriptors, m_removeEmptyEntitiesDescriptors;
- set<xmltooling::QName> m_roles;
+ ptr_set<xmltooling::QName> m_roles;
bool m_idp, m_sp, m_authn, m_attr, m_pdp, m_authnq, m_attrq, m_authzq;
};
else if (*q == AuthzDecisionQueryDescriptorType::TYPE_QNAME)
m_authzq = true;
else
- m_roles.insert(*q.get());
+ m_roles.insert(q);
}
e = XMLHelper::getNextSiblingElement(e, RetainedRole);
}
doFilter(dynamic_cast<EntitiesDescriptor&>(xmlObject));
return;
}
- catch (bad_cast) {
+ catch (bad_cast&) {
}
try {
doFilter(dynamic_cast<EntityDescriptor&>(xmlObject));
return;
}
- catch (bad_cast) {
+ catch (bad_cast&) {
}
throw MetadataFilterException("EntityRoleWhiteList MetadataFilter was given an improper metadata instance to filter.");
{
Category& log=Category::getInstance(SAML_LOGCAT".MetadataFilter.EntityRoleWhiteList");
- VectorOf(EntityDescriptor) v=entities.getEntityDescriptors();
- for (VectorOf(EntityDescriptor)::size_type i=0; i<v.size(); ) {
+ VectorOf(EntityDescriptor) v = entities.getEntityDescriptors();
+ for (VectorOf(EntityDescriptor)::size_type i = 0; i < v.size(); ) {
doFilter(*v[i]);
if (m_removeRolelessEntityDescriptors) {
const EntityDescriptor& e = const_cast<const EntityDescriptor&>(*v[i]);
i++;
}
- VectorOf(EntitiesDescriptor) groups=entities.getEntitiesDescriptors();
- for (VectorOf(EntitiesDescriptor)::size_type j=0; j<groups.size(); ) {
+ VectorOf(EntitiesDescriptor) groups = entities.getEntitiesDescriptors();
+ for (VectorOf(EntitiesDescriptor)::size_type j = 0; j < groups.size(); ) {
EntitiesDescriptor* group = groups[j];
doFilter(*group);
if (m_removeEmptyEntitiesDescriptors && group->getEntitiesDescriptors().empty() && group->getEntityDescriptors().empty()) {
entity.getAuthzDecisionQueryDescriptorTypes().clear();
VectorOf(RoleDescriptor) v = entity.getRoleDescriptors();
- for (VectorOf(RoleDescriptor)::size_type i=0; i<v.size(); ) {
+ for (VectorOf(RoleDescriptor)::size_type i = 0; i < v.size(); ) {
const xmltooling::QName* type = v[i]->getSchemaType();
if (!type || m_roles.find(*type) != m_roles.end())
v.erase(v.begin() + i);