2 * Licensed to the University Corporation for Advanced Internet
3 * Development, Inc. (UCAID) under one or more contributor license
4 * agreements. See the NOTICE file distributed with this work for
5 * additional information regarding copyright ownership.
7 * UCAID licenses this file to you under the Apache License,
8 * Version 2.0 (the "License"); you may not use this file except
9 * in compliance with the License. You may obtain a copy of the
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
17 * either express or implied. See the License for the specific
18 * language governing permissions and limitations under the License.
22 * BasicFilteringContext.cpp
24 * A trivial FilteringContext implementation.
28 #include "Application.h"
29 #include "attribute/Attribute.h"
30 #include "attribute/filtering/BasicFilteringContext.h"
32 #include <saml/saml2/metadata/Metadata.h>
34 using namespace shibsp;
35 using namespace opensaml::saml2md;
38 FilteringContext::FilteringContext()
42 FilteringContext::~FilteringContext()
46 BasicFilteringContext::BasicFilteringContext(
47 const Application& app,
48 const vector<Attribute*>& attributes,
49 const RoleDescriptor* role,
50 const XMLCh* authncontext_class,
51 const XMLCh* authncontext_decl
52 ) : m_app(app), m_role(role), m_issuer(nullptr), m_class(authncontext_class), m_decl(authncontext_decl)
55 m_issuer = dynamic_cast<EntityDescriptor*>(role->getParent())->getEntityID();
56 for (vector<Attribute*>::const_iterator a = attributes.begin(); a != attributes.end(); ++a)
57 m_attributes.insert(multimap<string,Attribute*>::value_type((*a)->getId(), *a));
60 BasicFilteringContext::~BasicFilteringContext()
64 const Application& BasicFilteringContext::getApplication() const
69 const XMLCh* BasicFilteringContext::getAuthnContextClassRef() const
74 const XMLCh* BasicFilteringContext::getAuthnContextDeclRef() const
79 const XMLCh* BasicFilteringContext::getAttributeRequester() const
81 if (getAttributeIssuerMetadata()) {
82 return getApplication().getRelyingParty(
83 dynamic_cast<const EntityDescriptor*>(getAttributeIssuerMetadata()->getParent())
84 )->getXMLString("entityID").second;
86 return getApplication().getRelyingParty(getAttributeIssuer())->getXMLString("entityID").second;
89 const XMLCh* BasicFilteringContext::getAttributeIssuer() const
94 const RoleDescriptor* BasicFilteringContext::getAttributeRequesterMetadata() const
99 const RoleDescriptor* BasicFilteringContext::getAttributeIssuerMetadata() const
104 const multimap<string,Attribute*>& BasicFilteringContext::getAttributes() const