Fix mistake in version-info. Age wasn't supposed to be incremented.
[shibboleth/cpp-sp.git] / shib / internal.h
1 /*
2  *  Copyright 2001-2005 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 /* internal.h - internally visible classes
18
19    Scott Cantor
20    9/6/02
21
22    $History:$
23 */
24
25 #ifndef __shib_internal_h__
26 #define __shib_internal_h__
27
28 #ifdef WIN32
29 # define SHIB_EXPORTS __declspec(dllexport)
30 #endif
31
32 // eventually we might be able to support autoconf via cygwin...
33 #if defined (_MSC_VER) || defined(__BORLANDC__)
34 # include "config_win32.h"
35 #else
36 # include "config.h"
37 #endif
38
39 #include "shib.h"
40
41 #if defined(HAVE_LOG4SHIB)
42 # include <log4shib/Category.hh>
43 # include <log4shib/CategoryStream.hh>
44 namespace shibboleth {
45     namespace logging = log4shib;
46 };
47 #elif defined(HAVE_LOG4CPP)
48 # include <log4cpp/Category.hh>
49 # include <log4cpp/CategoryStream.hh>
50 namespace shibboleth {
51     namespace logging = log4cpp;
52 };
53 #else
54 # error "Supported logging library not available."
55 #endif
56
57 #define SHIB_LOGCAT "Shibboleth"
58
59 namespace shibboleth {
60     class BasicTrust : public ITrust
61     {
62     public:
63         BasicTrust(const DOMElement* e);
64         ~BasicTrust();
65
66         bool validate(void* certEE, const saml::Iterator<void*>& certChain, const IRoleDescriptor* role, bool checkName=true);
67         bool validate(const saml::SAMLSignedObject& token, const IRoleDescriptor* role, ITrust* certValidator=NULL);
68     
69     protected:
70         bool m_debug;
71         std::vector<saml::KeyInfoResolver*> m_resolvers;
72     };
73
74     class ScopedAttribute : public saml::SAMLAttribute
75     {
76     public:
77         ScopedAttribute(
78             const XMLCh* name=NULL,
79             const XMLCh* ns=NULL,
80             const saml::QName* type=NULL,
81             long lifetime=0,
82             const saml::Iterator<const XMLCh*>& scopes=EMPTY(const XMLCh*),
83             const saml::Iterator<const XMLCh*>& values=EMPTY(const XMLCh*)
84             );
85         ScopedAttribute(DOMElement* e);
86         ScopedAttribute(std::istream& in);
87         ~ScopedAttribute();
88     
89         saml::SAMLObject* clone() const;
90         
91         saml::Iterator<const XMLCh*> getValues() const;
92         saml::Iterator<std::string> getSingleByteValues() const;
93         void setValues(const saml::Iterator<const XMLCh*>& values=EMPTY(const XMLCh*));
94         void addValue(const XMLCh* value);
95         void removeValue(unsigned long index);
96         
97         static const XMLCh Scope[];
98     protected:
99         void valueToDOM(unsigned int index, DOMElement* e) const;
100         void valueFromDOM(DOMElement* e);
101         void ownStrings();
102         
103         std::vector<const XMLCh*> m_scopes;
104         mutable std::vector<const XMLCh*> m_scopedValues;
105     };
106 }
107
108 #endif