VS10 solution files, convert from NULL macro to nullptr.
[shibboleth/sp.git] / shibsp / attribute / filtering / impl / BasicFilteringContext.cpp
1 /*
2  *  Copyright 2001-2010 Internet2
3  * 
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * BasicFilteringContext.cpp
19  * 
20  * A trivial FilteringContext implementation.
21  */
22
23 #include "internal.h"
24 #include "Application.h"
25 #include "attribute/Attribute.h"
26 #include "attribute/filtering/BasicFilteringContext.h"
27
28 #include <saml/saml2/metadata/Metadata.h>
29
30 using namespace shibsp;
31 using namespace opensaml::saml2md;
32 using namespace std;
33
34 FilteringContext::FilteringContext()
35 {
36 }
37
38 FilteringContext::~FilteringContext()
39 {
40 }
41
42 BasicFilteringContext::BasicFilteringContext(
43     const Application& app,
44     const vector<Attribute*>& attributes,
45     const RoleDescriptor* role,
46     const XMLCh* authncontext_class,
47     const XMLCh* authncontext_decl
48     ) : m_app(app), m_role(role), m_issuer(nullptr), m_class(authncontext_class), m_decl(authncontext_decl)
49 {
50     if (role)
51         m_issuer = dynamic_cast<EntityDescriptor*>(role->getParent())->getEntityID();
52     for (vector<Attribute*>::const_iterator a = attributes.begin(); a != attributes.end(); ++a)
53         m_attributes.insert(multimap<string,Attribute*>::value_type((*a)->getId(), *a));
54 }
55
56 BasicFilteringContext::~BasicFilteringContext()
57 {
58 }
59
60 const Application& BasicFilteringContext::getApplication() const
61 {
62     return m_app;
63 }
64
65 const XMLCh* BasicFilteringContext::getAuthnContextClassRef() const
66 {
67     return m_class;
68 }
69
70 const XMLCh* BasicFilteringContext::getAuthnContextDeclRef() const
71 {
72     return m_decl;
73 }
74
75 const XMLCh* BasicFilteringContext::getAttributeRequester() const
76 {
77     return m_app.getXMLString("entityID").second;
78 }
79
80 const XMLCh* BasicFilteringContext::getAttributeIssuer() const
81 {
82     return m_issuer;
83 }
84
85 const RoleDescriptor* BasicFilteringContext::getAttributeRequesterMetadata() const
86 {
87     return nullptr;
88 }
89
90 const RoleDescriptor* BasicFilteringContext::getAttributeIssuerMetadata() const
91 {
92     return m_role;
93 }
94
95 const multimap<string,Attribute*>& BasicFilteringContext::getAttributes() const
96 {
97     return m_attributes;
98 }