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 * @file shibsp/attribute/resolver/AttributeResolver.h
24 * A service that transforms or resolves additional attributes for a
28 #ifndef __shibsp_resolver_h__
29 #define __shibsp_resolver_h__
31 #include <shibsp/base.h>
35 #include <xmltooling/Lockable.h>
38 class SAML_API Assertion;
40 class SAML_API NameID;
43 class SAML_API EntityDescriptor;
49 class SHIBSP_API Application;
50 class SHIBSP_API Attribute;
51 class SHIBSP_API Session;
52 class SHIBSP_API ResolutionContext;
54 #if defined (_MSC_VER)
55 #pragma warning( push )
56 #pragma warning( disable : 4250 4251 )
60 * The service that resolves the attributes for a particular subject.
62 class SHIBSP_API AttributeResolver : public virtual xmltooling::Lockable
64 MAKE_NONCOPYABLE(AttributeResolver);
68 virtual ~AttributeResolver();
71 * Creates a ResolutionContext based on session bootstrap material.
73 * <p>This enables resolution to occur ahead of session creation so that
74 * Attributes can be supplied while creating the session.
76 * @param application reference to Application that owns the eventual Session
77 * @param issuer issuing metadata of assertion issuer, if known
78 * @param protocol protocol used to establish Session
79 * @param nameid principal identifier, normalized to SAML 2, if any
80 * @param authncontext_class method/category of authentication event, if known
81 * @param authncontext_decl specifics of authentication event, if known
82 * @param tokens assertions initiating the Session, if any
83 * @param attributes array of previously resolved attributes, if any
84 * @return newly created ResolutionContext, owned by caller
86 virtual ResolutionContext* createResolutionContext(
87 const Application& application,
88 const opensaml::saml2md::EntityDescriptor* issuer,
89 const XMLCh* protocol,
90 const opensaml::saml2::NameID* nameid=nullptr,
91 const XMLCh* authncontext_class=nullptr,
92 const XMLCh* authncontext_decl=nullptr,
93 const std::vector<const opensaml::Assertion*>* tokens=nullptr,
94 const std::vector<Attribute*>* attributes=nullptr
98 * Creates a ResolutionContext for an existing Session.
100 * @param application reference to Application that owns the Session
101 * @param session reference to Session
102 * @return newly created ResolutionContext, owned by caller
104 virtual ResolutionContext* createResolutionContext(const Application& application, const Session& session) const=0;
108 * Resolves attributes for a given subject and returns them in the supplied context.
110 * @param ctx resolution context to use to resolve attributes
112 * @throws AttributeResolutionException thrown if there is a problem resolving the attributes for the subject
114 virtual void resolveAttributes(ResolutionContext& ctx) const=0;
117 * Populates an array with the set of Attribute IDs that might be generated.
119 * @param attributes array to populate
121 virtual void getAttributeIds(std::vector<std::string>& attributes) const=0;
124 #if defined (_MSC_VER)
125 #pragma warning( pop )
129 * Registers AttributeResolver classes into the runtime.
131 void SHIBSP_API registerAttributeResolvers();
133 /** AttributeResolver based on SAML queries to an IdP during SSO. */
134 #define QUERY_ATTRIBUTE_RESOLVER "Query"
136 /** AttributeResolver based on free-standing SAML queries to additional AAs. */
137 #define SIMPLEAGGREGATION_ATTRIBUTE_RESOLVER "SimpleAggregation"
139 /** AttributeResolver based on chaining together other resolvers. */
140 #define CHAINING_ATTRIBUTE_RESOLVER "Chaining"
143 #endif /* __shibsp_resolver_h__ */