2 * Copyright 2001-2009 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/NameIDAttribute.h
20 * An Attribute whose values are derived from or mappable to a SAML NameID.
23 #ifndef __shibsp_nameidattr_h__
24 #define __shibsp_nameidattr_h__
26 #include <shibsp/attribute/Attribute.h>
30 #if defined (_MSC_VER)
31 #pragma warning( push )
32 #pragma warning( disable : 4251 )
35 /** Default serialization format for NameIDs */
36 #define DEFAULT_NAMEID_FORMATTER "$Name!!$NameQualifier!!$SPNameQualifier"
39 * An Attribute whose values are derived from or mappable to a SAML NameID.
41 class SHIBSP_API NameIDAttribute : public Attribute
47 * @param ids array with primary identifier in first position, followed by any aliases
48 * @param formatter template for serialization of tuple
50 NameIDAttribute(const std::vector<std::string>& ids, const char* formatter=DEFAULT_NAMEID_FORMATTER);
53 * Constructs based on a remoted NameIDAttribute.
55 * @param in input object containing marshalled NameIDAttribute
57 NameIDAttribute(DDF& in);
59 virtual ~NameIDAttribute();
62 * Holds all the fields associated with a NameID.
64 struct SHIBSP_API Value
68 std::string m_NameQualifier;
69 std::string m_SPNameQualifier;
70 std::string m_SPProvidedID;
74 * Returns the set of values encoded as UTF-8 strings.
76 * @return a mutable vector of the values
78 std::vector<Value>& getValues();
81 * Returns the set of values encoded as UTF-8 strings.
83 * @return an immutable vector of the values
85 const std::vector<Value>& getValues() const;
87 // Virtual function overrides.
88 size_t valueCount() const;
89 void clearSerializedValues();
90 const char* getString(size_t index) const;
91 const char* getScope(size_t index) const;
92 void removeValue(size_t index);
93 const std::vector<std::string>& getSerializedValues() const;
97 std::vector<Value> m_values;
98 std::string m_formatter;
101 #if defined (_MSC_VER)
102 #pragma warning( pop )
107 #endif /* __shibsp_nameidattr_h__ */