2 * Copyright 2001-2005 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.
25 #ifndef __internal_h__
26 #define __internal_h__
28 #include <saml/saml.h>
29 #include <shib/shib.h>
30 #include <shib-target/shib-target.h>
31 #include <shib-target/hresult.h>
33 #if defined (_MSC_VER) || defined(__BORLANDC__)
34 # include "config_win32.h"
39 #if defined(HAVE_LOG4SHIB)
40 # include <log4shib/Category.hh>
41 # include <log4shib/FixedContextCategory.hh>
43 namespace logging = log4shib;
45 #elif defined(HAVE_LOG4CPP)
46 # include <log4cpp/Category.hh>
47 # include <log4cpp/FixedContextCategory.hh>
49 namespace logging = log4cpp;
52 # error "Supported logging library not available."
56 #define ADFS_LOGCAT "shibtarget"
57 #define SHIBTRAN_LOGCAT "Shibboleth-TRANSACTION"
58 #define ADFS_L(s) adfs::XML::Literals::s
62 extern shibtarget::IListener* g_MemoryListener;
68 static const XMLCh WSFED_NS[]; // http://schemas.xmlsoap.org/ws/2003/07/secext
69 static const XMLCh WSTRUST_NS[]; // http://schemas.xmlsoap.org/ws/2005/02/trust
70 static const XMLCh WSTRUST_SCHEMA_ID[];
74 static const XMLCh RequestedSecurityToken[];
75 static const XMLCh RequestSecurityTokenResponse[];
79 // TODO: Publish these classes for reuse by extensions.
83 CgiParse(const char* data, unsigned int len);
85 const char* get_value(const char* name) const;
87 static char x2c(char *what);
88 static void url_decode(char *url);
89 static std::string url_encode(const char* s);
91 char * fmakeword(char stop, unsigned int *cl, const char** ppch);
92 char * makeword(char *line, char stop);
93 void plustospace(char *str);
95 std::map<std::string,char*> kvp_map;
98 // Helper class for SAML 2.0 Common Domain Cookie operations
99 class CommonDomainCookie
102 CommonDomainCookie(const char* cookie);
103 ~CommonDomainCookie() {}
104 saml::Iterator<std::string> get() {return m_list;}
105 const char* set(const char* providerId);
106 static const char CDCName[];
108 std::string m_encoded;
109 std::vector<std::string> m_list;
112 saml::SAMLAuthenticationStatement* checkAssertionProfile(const saml::SAMLAssertion* a);