X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fcpp-opensaml.git;a=blobdiff_plain;f=saml%2Fsaml2%2Fmetadata%2Fimpl%2FEntityRoleMetadataFilter.cpp;h=1017788e027bfa25dc1d810f83f89a2728eebe89;hp=349770697162df95132b2e1320a638ae9fa33a90;hb=208928133db000b055b99fcbabc245295adb0d48;hpb=16d5976c9821b70d95675983702e0032d8769467 diff --git a/saml/saml2/metadata/impl/EntityRoleMetadataFilter.cpp b/saml/saml2/metadata/impl/EntityRoleMetadataFilter.cpp index 3497706..1017788 100644 --- a/saml/saml2/metadata/impl/EntityRoleMetadataFilter.cpp +++ b/saml/saml2/metadata/impl/EntityRoleMetadataFilter.cpp @@ -1,17 +1,21 @@ -/* - * 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. */ /** @@ -24,12 +28,14 @@ #include "saml2/metadata/Metadata.h" #include "saml2/metadata/MetadataFilter.h" +#include #include #include using namespace opensaml::saml2md; using namespace xmltooling::logging; using namespace xmltooling; +using namespace boost; using namespace std; namespace opensaml { @@ -49,7 +55,7 @@ namespace opensaml { void doFilter(EntitiesDescriptor& entities) const; bool m_removeRolelessEntityDescriptors, m_removeEmptyEntitiesDescriptors; - set m_roles; + ptr_set m_roles; bool m_idp, m_sp, m_authn, m_attr, m_pdp, m_authnq, m_attrq, m_authzq; }; @@ -91,7 +97,7 @@ EntityRoleMetadataFilter::EntityRoleMetadataFilter(const DOMElement* e) else if (*q == AuthzDecisionQueryDescriptorType::TYPE_QNAME) m_authzq = true; else - m_roles.insert(*q.get()); + m_roles.insert(q); } e = XMLHelper::getNextSiblingElement(e, RetainedRole); } @@ -107,14 +113,14 @@ void EntityRoleMetadataFilter::doFilter(XMLObject& xmlObject) const doFilter(dynamic_cast(xmlObject)); return; } - catch (bad_cast) { + catch (bad_cast&) { } try { doFilter(dynamic_cast(xmlObject)); return; } - catch (bad_cast) { + catch (bad_cast&) { } throw MetadataFilterException("EntityRoleWhiteList MetadataFilter was given an improper metadata instance to filter."); @@ -124,8 +130,8 @@ void EntityRoleMetadataFilter::doFilter(EntitiesDescriptor& entities) const { Category& log=Category::getInstance(SAML_LOGCAT".MetadataFilter.EntityRoleWhiteList"); - VectorOf(EntityDescriptor) v=entities.getEntityDescriptors(); - for (VectorOf(EntityDescriptor)::size_type i=0; i(*v[i]); @@ -147,8 +153,8 @@ void EntityRoleMetadataFilter::doFilter(EntitiesDescriptor& entities) const i++; } - VectorOf(EntitiesDescriptor) groups=entities.getEntitiesDescriptors(); - for (VectorOf(EntitiesDescriptor)::size_type j=0; jgetEntitiesDescriptors().empty() && group->getEntityDescriptors().empty()) { @@ -187,7 +193,7 @@ void EntityRoleMetadataFilter::doFilter(EntityDescriptor& entity) const entity.getAuthzDecisionQueryDescriptorTypes().clear(); VectorOf(RoleDescriptor) v = entity.getRoleDescriptors(); - for (VectorOf(RoleDescriptor)::size_type i=0; igetSchemaType(); if (!type || m_roles.find(*type) != m_roles.end()) v.erase(v.begin() + i);