2 * Copyright 2001-2007 Internet2
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file shibsp/attribute/resolver/AttributeResolver.h
20 * The service that resolves the attributes for a particular subject.
23 #ifndef __shibsp_resolver_h__
24 #define __shibsp_resolver_h__
26 #include <shibsp/base.h>
28 #include <saml/saml1/core/Assertions.h>
29 #include <saml/saml2/metadata/Metadata.h>
30 #include <xmltooling/Lockable.h>
34 class SHIBSP_API Application;
35 class SHIBSP_API Attribute;
36 class SHIBSP_API Session;
37 class SHIBSP_API ResolutionContext;
39 #if defined (_MSC_VER)
40 #pragma warning( push )
41 #pragma warning( disable : 4250 4251 )
45 * The service that resolves the attributes for a particular subject.
47 class SHIBSP_API AttributeResolver : public virtual xmltooling::Lockable
49 MAKE_NONCOPYABLE(AttributeResolver);
51 AttributeResolver() {}
53 virtual ~AttributeResolver() {}
56 * Creates a ResolutionContext based on session bootstrap material.
58 * <p>This enables resolution to occur ahead of session creation so that
59 * Attributes can be supplied while creating the session.
61 * @param application reference to Application that owns the eventual Session
62 * @param client_addr network address of client
63 * @param issuer issuing metadata of assertion issuer, if known
64 * @param nameid principal identifier, normalized to SAML 2
65 * @param ssoToken SSO assertion initiating the session, if any
66 * @return newly created ResolutionContext, owned by caller
68 virtual ResolutionContext* createResolutionContext(
69 const Application& application,
70 const char* client_addr,
71 const opensaml::saml2md::EntityDescriptor* issuer,
72 const opensaml::saml2::NameID& nameid,
73 const opensaml::RootObject* ssoToken=NULL
77 * Creates a ResolutionContext for an existing Session.
79 * @param application reference to Application that owns the Session
80 * @param session reference to Session
81 * @return newly created ResolutionContext, owned by caller
83 virtual ResolutionContext* createResolutionContext(const Application& application, const Session& session) const=0;
87 * Gets the attributes for a given subject and returns them in the supplied context.
89 * @param ctx resolution context to use to resolve attributes
90 * @param attributes list of attributes to resolve or NULL to resolve all attributes
92 * @throws AttributeResolutionException thrown if there is a problem resolving the attributes for the subject
94 virtual void resolveAttributes(ResolutionContext& ctx, const std::vector<const char*>* attributes=NULL) const=0;
97 #if defined (_MSC_VER)
98 #pragma warning( pop )
102 * Registers AttributeResolver classes into the runtime.
104 void SHIBSP_API registerAttributeResolvers();
106 /** AttributeResolver based on a simple mapping of SAML information. */
107 #define SIMPLE_ATTRIBUTE_RESOLVER "Simple"
110 #endif /* __shibsp_resolver_h__ */