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.
18 * mod_apache.cpp -- the core Apache Module code
20 * Created by: Derek Atkins <derek@ihtfp.com>
26 #undef _XOPEN_SOURCE // causes gethostname conflict in unistd.h
30 # define _CRT_NONSTDC_NO_DEPRECATE 1
31 # define _CRT_SECURE_NO_DEPRECATE 1
34 #include <shibsp/AccessControl.h>
35 #include <shibsp/exceptions.h>
36 #include <shibsp/RequestMapper.h>
37 #include <shibsp/SPConfig.h>
40 #include <saml/saml.h>
41 #include <shib/shib.h>
42 #include <shib-target/shib-target.h>
43 #include <xercesc/util/regx/RegularExpression.hpp>
44 #include <xmltooling/util/NDC.h>
45 #include <xmltooling/util/Threads.h>
53 // Apache specific header files
55 #include <http_config.h>
56 #include <http_protocol.h>
57 #include <http_main.h>
59 #include <http_core.h>
62 #ifndef SHIB_APACHE_13
63 #include <http_request.h>
64 #include <apr_strings.h>
65 #include <apr_pools.h>
72 #include <unistd.h> // for getpid()
75 using namespace shibsp;
76 using namespace shibtarget;
77 using namespace xmltooling;
80 extern "C" module MODULE_VAR_EXPORT mod_shib;
83 char* g_szSHIBConfig = NULL;
84 char* g_szSchemaDir = NULL;
85 ShibTargetConfig* g_Config = NULL;
86 string g_unsetHeaderValue;
87 static const char* g_UserDataKey = "_shib_check_user_";
90 /* Apache 2.2.x headers must be accumulated and set in the output filter.
91 Apache 2.0.49+ supports the filter method.
92 Apache 1.3.x and lesser 2.0.x must write the headers directly. */
94 #if (defined(SHIB_APACHE_20) || defined(SHIB_APACHE_22)) && AP_MODULE_MAGIC_AT_LEAST(20020903,6)
95 #define SHIB_DEFERRED_HEADERS
98 /********************************************************************************/
99 // Basic Apache Configuration code.
102 // per-server module configuration structure
103 struct shib_server_config
108 // creates the per-server configuration
109 extern "C" void* create_shib_server_config(SH_AP_POOL* p, server_rec* s)
111 shib_server_config* sc=(shib_server_config*)ap_pcalloc(p,sizeof(shib_server_config));
116 // overrides server configuration in virtual servers
117 extern "C" void* merge_shib_server_config (SH_AP_POOL* p, void* base, void* sub)
119 shib_server_config* sc=(shib_server_config*)ap_pcalloc(p,sizeof(shib_server_config));
120 shib_server_config* parent=(shib_server_config*)base;
121 shib_server_config* child=(shib_server_config*)sub;
124 sc->szScheme=ap_pstrdup(p,child->szScheme);
125 else if (parent->szScheme)
126 sc->szScheme=ap_pstrdup(p,parent->szScheme);
133 // per-dir module configuration structure
134 struct shib_dir_config
137 char* szAuthGrpFile; // Auth GroupFile name
138 int bRequireAll; // all require directives must match, otherwise OR logic
140 // Content Configuration
141 char* szApplicationId; // Shib applicationId value
142 char* szRequireWith; // require a session using a specific initiator?
143 char* szRedirectToSSL; // redirect non-SSL requests to SSL port
144 int bOff; // flat-out disable all Shib processing
145 int bBasicHijack; // activate for AuthType Basic?
146 int bRequireSession; // require a session?
147 int bExportAssertion; // export SAML assertion to the environment?
148 int bUseEnvVars; // use environment instead of headers?
151 // creates per-directory config structure
152 extern "C" void* create_shib_dir_config (SH_AP_POOL* p, char* d)
154 shib_dir_config* dc=(shib_dir_config*)ap_pcalloc(p,sizeof(shib_dir_config));
156 dc->bBasicHijack = -1;
157 dc->bRequireSession = -1;
158 dc->bExportAssertion = -1;
159 dc->bRequireAll = -1;
160 dc->szRedirectToSSL = NULL;
161 dc->szAuthGrpFile = NULL;
162 dc->szApplicationId = NULL;
163 dc->szRequireWith = NULL;
164 dc->bUseEnvVars = -1;
168 // overrides server configuration in directories
169 extern "C" void* merge_shib_dir_config (SH_AP_POOL* p, void* base, void* sub)
171 shib_dir_config* dc=(shib_dir_config*)ap_pcalloc(p,sizeof(shib_dir_config));
172 shib_dir_config* parent=(shib_dir_config*)base;
173 shib_dir_config* child=(shib_dir_config*)sub;
175 if (child->szAuthGrpFile)
176 dc->szAuthGrpFile=ap_pstrdup(p,child->szAuthGrpFile);
177 else if (parent->szAuthGrpFile)
178 dc->szAuthGrpFile=ap_pstrdup(p,parent->szAuthGrpFile);
180 dc->szAuthGrpFile=NULL;
182 if (child->szApplicationId)
183 dc->szApplicationId=ap_pstrdup(p,child->szApplicationId);
184 else if (parent->szApplicationId)
185 dc->szApplicationId=ap_pstrdup(p,parent->szApplicationId);
187 dc->szApplicationId=NULL;
189 if (child->szRequireWith)
190 dc->szRequireWith=ap_pstrdup(p,child->szRequireWith);
191 else if (parent->szRequireWith)
192 dc->szRequireWith=ap_pstrdup(p,parent->szRequireWith);
194 dc->szRequireWith=NULL;
196 if (child->szRedirectToSSL)
197 dc->szRedirectToSSL=ap_pstrdup(p,child->szRedirectToSSL);
198 else if (parent->szRedirectToSSL)
199 dc->szRedirectToSSL=ap_pstrdup(p,parent->szRedirectToSSL);
201 dc->szRedirectToSSL=NULL;
203 dc->bOff=((child->bOff==-1) ? parent->bOff : child->bOff);
204 dc->bBasicHijack=((child->bBasicHijack==-1) ? parent->bBasicHijack : child->bBasicHijack);
205 dc->bRequireSession=((child->bRequireSession==-1) ? parent->bRequireSession : child->bRequireSession);
206 dc->bExportAssertion=((child->bExportAssertion==-1) ? parent->bExportAssertion : child->bExportAssertion);
207 dc->bRequireAll=((child->bRequireAll==-1) ? parent->bRequireAll : child->bRequireAll);
208 dc->bUseEnvVars=((child->bUseEnvVars==-1) ? parent->bUseEnvVars : child->bUseEnvVars);
212 // per-request module structure
213 struct shib_request_config
215 SH_AP_TABLE *env; // environment vars
216 #ifdef SHIB_DEFERRED_HEADERS
217 SH_AP_TABLE *hdr_out; // headers to browser
218 SH_AP_TABLE *hdr_err; // err headers to browser
222 // create a request record
223 static shib_request_config *init_request_config(request_rec *r)
225 shib_request_config* rc=(shib_request_config*)ap_pcalloc(r->pool,sizeof(shib_request_config));
226 ap_set_module_config (r->request_config, &mod_shib, rc);
227 memset(rc, 0, sizeof(shib_request_config));
228 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(r), "shib_init_rc");
232 // generic global slot handlers
233 extern "C" const char* ap_set_global_string_slot(cmd_parms* parms, void*, const char* arg)
235 *((char**)(parms->info))=ap_pstrdup(parms->pool,arg);
239 extern "C" const char* shib_set_server_string_slot(cmd_parms* parms, void*, const char* arg)
241 char* base=(char*)ap_get_module_config(parms->server->module_config,&mod_shib);
242 size_t offset=(size_t)parms->info;
243 *((char**)(base + offset))=ap_pstrdup(parms->pool,arg);
247 extern "C" const char* shib_ap_set_file_slot(cmd_parms* parms,
248 #ifdef SHIB_APACHE_13
249 char* arg1, char* arg2
251 void* arg1, const char* arg2
255 ap_set_file_slot(parms, arg1, arg2);
259 /********************************************************************************/
260 // Apache ShibTarget subclass(es) here.
262 class ShibTargetApache : public ShibTarget
264 mutable string m_body;
265 mutable bool m_gotBody;
266 vector<XSECCryptoX509*> m_certs;
270 shib_dir_config* m_dc;
271 shib_server_config* m_sc;
272 shib_request_config* m_rc;
274 ShibTargetApache(request_rec* req) : m_gotBody(false) {
275 m_sc = (shib_server_config*)ap_get_module_config(req->server->module_config, &mod_shib);
276 m_dc = (shib_dir_config*)ap_get_module_config(req->per_dir_config, &mod_shib);
277 m_rc = (shib_request_config*)ap_get_module_config(req->request_config, &mod_shib);
281 m_sc->szScheme ? m_sc->szScheme : ap_http_method(req),
282 ap_get_server_name(req),
283 (int)ap_get_server_port(req),
287 virtual ~ShibTargetApache() {}
289 const char* getScheme() const {
290 return m_sc->szScheme ? m_sc->szScheme : ap_http_method(m_req);
292 const char* getHostname() const {
293 return ap_get_server_name(m_req);
295 int getPort() const {
296 return ap_get_server_port(m_req);
298 const char* getRequestURI() const {
299 return m_req->unparsed_uri;
301 const char* getMethod() const {
302 return m_req->method;
304 string getContentType() const {
305 const char* type = ap_table_get(m_req->headers_in, "Content-Type");
306 return type ? type : "";
308 long getContentLength() const {
309 return m_gotBody ? m_body.length() : m_req->remaining;
311 string getRemoteAddr() const {
312 return m_req->connection->remote_ip;
314 void log(SPLogLevel level, const string& msg) const {
315 AbstractSPRequest::log(level,msg);
318 (level == SPDebug ? APLOG_DEBUG :
319 (level == SPInfo ? APLOG_INFO :
320 (level == SPWarn ? APLOG_WARNING :
321 (level == SPError ? APLOG_ERR : APLOG_CRIT))))|APLOG_NOERRNO,
326 const char* getQueryString() const { return m_req->args; }
327 const char* getRequestBody() const {
329 return m_body.c_str();
330 // Read the posted data
331 if (ap_setup_client_block(m_req, REQUEST_CHUNKED_ERROR))
332 throw opensaml::BindingException("Apache function (setup_client_block) failed while reading POST request body.");
333 if (!ap_should_client_block(m_req))
334 throw opensaml::BindingException("Apache function (should_client_block) failed while reading POST request body.");
335 if (m_req->remaining > 1024*1024)
336 throw opensaml::BindingException("Blocked POST request body larger than size limit.");
338 char buff[HUGE_STRING_LEN];
339 ap_hard_timeout("[mod_shib] getRequestBody", m_req);
340 memset(buff, 0, sizeof(buff));
341 while (ap_get_client_block(m_req, buff, sizeof(buff)-1) > 0) {
342 ap_reset_timeout(m_req);
344 memset(buff, 0, sizeof(buff));
346 ap_kill_timeout(m_req);
347 return m_body.c_str();
349 void clearHeader(const char* name) {
350 if (m_dc->bUseEnvVars!=0) {
351 // ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(m_req), "shib_clear_header: env\n");
352 if (m_rc && m_rc->env) ap_table_unset(m_rc->env, name);
354 // ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(m_req), "shib_clear_header: hdr\n");
355 ap_table_unset(m_req->headers_in, name);
356 ap_table_set(m_req->headers_in, name, g_unsetHeaderValue.c_str());
359 void setHeader(const char* name, const char* value) {
360 if (m_dc->bUseEnvVars!=0) {
362 // this happens on subrequests
363 // ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(m_req), "shib_setheader: no_m_rc\n");
364 m_rc = init_request_config(m_req);
366 if (!m_rc->env) m_rc->env = ap_make_table(m_req->pool, 10);
367 // ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(m_req), "shib_set_env: %s=%s\n", name, value?value:"Null");
368 ap_table_set(m_rc->env, name, value?value:"");
371 ap_table_set(m_req->headers_in, name, value);
374 string getHeader(const char* name) const {
375 const char* hdr = ap_table_get(m_req->headers_in, name);
376 return string(hdr ? hdr : "");
378 string getSecureHeader(const char* name) const {
379 if (m_dc->bUseEnvVars!=0) {
381 if (m_rc && m_rc->env)
382 hdr = ap_table_get(m_rc->env, name);
385 return string(hdr ? hdr : "");
387 return getHeader(name);
389 void setRemoteUser(const char* user) {
390 SH_AP_USER(m_req) = user ? ap_pstrdup(m_req->pool, user) : NULL;
392 string getRemoteUser() const {
393 return string(SH_AP_USER(m_req) ? SH_AP_USER(m_req) : "");
395 void setContentType(const char* type) {
396 m_req->content_type = ap_psprintf(m_req->pool, type);
398 void setResponseHeader(const char* name, const char* value) {
399 #ifdef SHIB_DEFERRED_HEADERS
401 // this happens on subrequests
402 m_rc = init_request_config(m_req);
403 ap_table_add(m_rc->hdr_err, name, value);
404 ap_table_add(m_rc->hdr_out, name, value);
406 ap_table_add(m_req->err_headers_out, name, value);
409 long sendResponse(istream& in, long status) {
410 ap_send_http_header(m_req);
414 ap_rwrite(buf,in.gcount(),m_req);
416 return ((status==SAML_HTTP_STATUS_OK) ? DONE : status);
418 long sendRedirect(const char* url) {
419 ap_table_set(m_req->headers_out, "Location", url);
422 const vector<XSECCryptoX509*>& getClientCertificates() const {
425 long returnDecline(void) { return DECLINED; }
426 long returnOK(void) { return OK; }
429 /********************************************************************************/
432 extern "C" int shib_check_user(request_rec* r)
434 // Short-circuit entirely?
435 if (((shib_dir_config*)ap_get_module_config(r->per_dir_config, &mod_shib))->bOff==1)
438 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(r), "shib_check_user(%d): ENTER\n", (int)getpid());
440 ostringstream threadid;
441 threadid << "[" << getpid() << "] shib_check_user" << '\0';
442 xmltooling::NDC ndc(threadid.str().c_str());
445 ShibTargetApache sta(r);
447 // Check user authentication and export information, then set the handler bypass
448 pair<bool,long> res = sta.doCheckAuthN(true);
449 apr_pool_userdata_setn((const void*)42,g_UserDataKey,NULL,r->pool);
450 if (res.first) return res.second;
452 // user auth was okay -- export the assertions now
453 res = sta.doExportAssertions();
454 if (res.first) return res.second;
456 // export happened successfully.. this user is ok.
459 catch (exception& e) {
460 ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, SH_AP_R(r), "shib_check_user threw an exception: %s", e.what());
465 ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, SH_AP_R(r), "shib_check_user threw an uncaught exception!");
471 extern "C" int shib_handler(request_rec* r)
473 // Short-circuit entirely?
474 if (((shib_dir_config*)ap_get_module_config(r->per_dir_config, &mod_shib))->bOff==1)
477 ostringstream threadid;
478 threadid << "[" << getpid() << "] shib_handler" << '\0';
479 xmltooling::NDC ndc(threadid.str().c_str());
481 #ifndef SHIB_APACHE_13
482 // With 2.x, this handler always runs, though last.
483 // We check if shib_check_user ran, because it will detect a handler request
484 // and dispatch it directly.
486 apr_pool_userdata_get(&data,g_UserDataKey,r->pool);
487 if (data==(const void*)42) {
488 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(r),"shib_handler skipped since check_user ran");
493 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(r),"shib_handler(%d): ENTER: %s", (int)getpid(), r->handler);
496 ShibTargetApache sta(r);
498 pair<bool,long> res = sta.doHandler();
499 if (res.first) return res.second;
501 ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, SH_AP_R(r), "doHandler() did not do anything.");
504 catch (exception& e) {
505 ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, SH_AP_R(r), "shib_handler threw an exception: %s", e.what());
510 ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, SH_AP_R(r), "shib_handler threw an uncaught exception!");
517 * shib_auth_checker() -- a simple resource manager to
518 * process the .htaccess settings
520 extern "C" int shib_auth_checker(request_rec* r)
522 // Short-circuit entirely?
523 if (((shib_dir_config*)ap_get_module_config(r->per_dir_config, &mod_shib))->bOff==1)
526 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(r), "shib_auth_checker(%d): ENTER", (int)getpid());
528 ostringstream threadid;
529 threadid << "[" << getpid() << "] shib_auth_checker" << '\0';
530 xmltooling::NDC ndc(threadid.str().c_str());
533 ShibTargetApache sta(r);
535 pair<bool,long> res = sta.doCheckAuthZ();
536 if (res.first) return res.second;
541 catch (exception& e) {
542 ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, SH_AP_R(r), "shib_auth_checker threw an exception: %s", e.what());
547 ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, SH_AP_R(r), "shib_auth_checker threw an uncaught exception!");
553 // Access control plugin that enforces htaccess rules
554 class htAccessControl : virtual public AccessControl
558 ~htAccessControl() {}
559 Lockable* lock() {return this;}
561 bool authorized(SPRequest& request, Session* session) const;
564 AccessControl* htAccessFactory(const DOMElement* const & e)
566 return new htAccessControl();
569 class ApacheRequestMapper : public virtual RequestMapper, public virtual PropertySet
572 ApacheRequestMapper(const DOMElement* e);
573 ~ApacheRequestMapper() { delete m_mapper; delete m_htaccess; delete m_staKey; delete m_propsKey; }
574 Lockable* lock() { return m_mapper->lock(); }
575 void unlock() { m_staKey->setData(NULL); m_propsKey->setData(NULL); m_mapper->unlock(); }
576 Settings getSettings(const SPRequest& request) const;
578 pair<bool,bool> getBool(const char* name, const char* ns=NULL) const;
579 pair<bool,const char*> getString(const char* name, const char* ns=NULL) const;
580 pair<bool,const XMLCh*> getXMLString(const char* name, const char* ns=NULL) const;
581 pair<bool,unsigned int> getUnsignedInt(const char* name, const char* ns=NULL) const;
582 pair<bool,int> getInt(const char* name, const char* ns=NULL) const;
583 const PropertySet* getPropertySet(const char* name, const char* ns="urn:mace:shibboleth:target:config:1.0") const;
584 const DOMElement* getElement() const;
587 RequestMapper* m_mapper;
589 ThreadKey* m_propsKey;
590 AccessControl* m_htaccess;
593 RequestMapper* ApacheRequestMapFactory(const DOMElement* const & e)
595 return new ApacheRequestMapper(e);
598 ApacheRequestMapper::ApacheRequestMapper(const DOMElement* e) : m_mapper(NULL), m_staKey(NULL), m_propsKey(NULL), m_htaccess(NULL)
600 m_mapper=SPConfig::getConfig().RequestMapperManager.newPlugin(XML_REQUEST_MAPPER,e);
601 m_htaccess=new htAccessControl();
602 m_staKey=ThreadKey::create(NULL);
603 m_propsKey=ThreadKey::create(NULL);
606 RequestMapper::Settings ApacheRequestMapper::getSettings(const SPRequest& request) const
608 Settings s=m_mapper->getSettings(request);
609 m_staKey->setData((void*)dynamic_cast<const ShibTargetApache*>(&request));
610 m_propsKey->setData((void*)s.first);
611 return pair<const PropertySet*,AccessControl*>(this,s.second ? s.second : m_htaccess);
614 pair<bool,bool> ApacheRequestMapper::getBool(const char* name, const char* ns) const
616 const ShibTargetApache* sta=reinterpret_cast<const ShibTargetApache*>(m_staKey->getData());
617 const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
619 // Override Apache-settable boolean properties.
620 if (name && !strcmp(name,"requireSession") && sta->m_dc->bRequireSession==1)
621 return make_pair(true,true);
622 else if (name && !strcmp(name,"exportAssertion") && sta->m_dc->bExportAssertion==1)
623 return make_pair(true,true);
625 return s ? s->getBool(name,ns) : make_pair(false,false);
628 pair<bool,const char*> ApacheRequestMapper::getString(const char* name, const char* ns) const
630 const ShibTargetApache* sta=reinterpret_cast<const ShibTargetApache*>(m_staKey->getData());
631 const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
633 // Override Apache-settable string properties.
634 if (name && !strcmp(name,"authType")) {
635 const char *auth_type=ap_auth_type(sta->m_req);
637 // Check for Basic Hijack
638 if (!strcasecmp(auth_type, "basic") && sta->m_dc->bBasicHijack == 1)
639 auth_type = "shibboleth";
640 return make_pair(true,auth_type);
643 else if (name && !strcmp(name,"applicationId") && sta->m_dc->szApplicationId)
644 return pair<bool,const char*>(true,sta->m_dc->szApplicationId);
645 else if (name && !strcmp(name,"requireSessionWith") && sta->m_dc->szRequireWith)
646 return pair<bool,const char*>(true,sta->m_dc->szRequireWith);
647 else if (name && !strcmp(name,"redirectToSSL") && sta->m_dc->szRedirectToSSL)
648 return pair<bool,const char*>(true,sta->m_dc->szRedirectToSSL);
650 return s ? s->getString(name,ns) : pair<bool,const char*>(false,NULL);
653 pair<bool,const XMLCh*> ApacheRequestMapper::getXMLString(const char* name, const char* ns) const
655 const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
656 return s ? s->getXMLString(name,ns) : pair<bool,const XMLCh*>(false,NULL);
659 pair<bool,unsigned int> ApacheRequestMapper::getUnsignedInt(const char* name, const char* ns) const
661 const ShibTargetApache* sta=reinterpret_cast<const ShibTargetApache*>(m_staKey->getData());
662 const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
664 // Override Apache-settable int properties.
665 if (name && !strcmp(name,"redirectToSSL") && sta->m_dc->szRedirectToSSL)
666 return pair<bool,unsigned int>(true,strtol(sta->m_dc->szRedirectToSSL,NULL,10));
668 return s ? s->getUnsignedInt(name,ns) : pair<bool,unsigned int>(false,0);
671 pair<bool,int> ApacheRequestMapper::getInt(const char* name, const char* ns) const
673 const ShibTargetApache* sta=reinterpret_cast<const ShibTargetApache*>(m_staKey->getData());
674 const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
676 // Override Apache-settable int properties.
677 if (name && !strcmp(name,"redirectToSSL") && sta->m_dc->szRedirectToSSL)
678 return pair<bool,int>(true,atoi(sta->m_dc->szRedirectToSSL));
680 return s ? s->getInt(name,ns) : pair<bool,int>(false,0);
683 const PropertySet* ApacheRequestMapper::getPropertySet(const char* name, const char* ns) const
685 const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
686 return s ? s->getPropertySet(name,ns) : NULL;
689 const DOMElement* ApacheRequestMapper::getElement() const
691 const PropertySet* s=reinterpret_cast<const PropertySet*>(m_propsKey->getData());
692 return s ? s->getElement() : NULL;
695 static SH_AP_TABLE* groups_for_user(request_rec* r, const char* user, char* grpfile)
698 SH_AP_TABLE* grps=ap_make_table(r->pool,15);
699 char l[MAX_STRING_LEN];
700 const char *group_name, *ll, *w;
702 #ifdef SHIB_APACHE_13
703 if (!(f=ap_pcfg_openfile(r->pool,grpfile))) {
705 if (ap_pcfg_openfile(&f,r->pool,grpfile) != APR_SUCCESS) {
707 ap_log_rerror(APLOG_MARK,APLOG_DEBUG,SH_AP_R(r),"groups_for_user() could not open group file: %s\n",grpfile);
712 #ifdef SHIB_APACHE_13
713 sp=ap_make_sub_pool(r->pool);
715 if (apr_pool_create(&sp,r->pool) != APR_SUCCESS) {
716 ap_log_rerror(APLOG_MARK,APLOG_ERR,0,r,
717 "groups_for_user() could not create a subpool");
722 while (!(ap_cfg_getline(l,MAX_STRING_LEN,f))) {
723 if ((*l=='#') || (!*l))
728 group_name=ap_getword(sp,&ll,':');
731 w=ap_getword_conf(sp,&ll);
732 if (!strcmp(w,user)) {
733 ap_table_setn(grps,ap_pstrdup(r->pool,group_name),"in");
743 bool htAccessControl::authorized(SPRequest& request, Session* session) const
745 // Make sure the object is our type.
746 ShibTargetApache* sta=dynamic_cast<ShibTargetApache*>(&request);
748 throw ConfigurationException("Request wrapper object was not of correct type.");
752 int m=sta->m_req->method_number;
753 bool method_restricted=false;
756 const array_header* reqs_arr=ap_requires(sta->m_req);
760 require_line* reqs=(require_line*)reqs_arr->elts;
762 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(sta->m_req),"REQUIRE nelts: %d", reqs_arr->nelts);
763 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(sta->m_req),"REQUIRE all: %d", sta->m_dc->bRequireAll);
765 vector<bool> auth_OK(reqs_arr->nelts,false);
767 #define SHIB_AP_CHECK_IS_OK { \
768 if (sta->m_dc->bRequireAll < 1) \
774 for (int x=0; x<reqs_arr->nelts; x++) {
776 if (!(reqs[x].method_mask & (1 << m)))
778 method_restricted=true;
779 string remote_user = request.getRemoteUser();
781 t = reqs[x].requirement;
782 w = ap_getword_white(sta->m_req->pool, &t);
784 if (!strcasecmp(w,"shibboleth")) {
785 // This is a dummy rule needed because Apache conflates authn and authz.
786 // Without some require rule, AuthType is ignored and no check_user hooks run.
789 else if (!strcmp(w,"valid-user")) {
791 request.log(SPRequest::SPDebug,"htAccessControl plugin accepting valid-user based on active session");
795 request.log(SPRequest::SPError,"htAccessControl plugin rejecting access for valid-user rule, no session is active");
797 else if (!strcmp(w,"user") && !remote_user.empty()) {
800 w=ap_getword_conf(sta->m_req->pool,&t);
808 // To do regex matching, we have to convert from UTF-8.
809 auto_ptr<XMLCh> trans(fromUTF8(w));
810 RegularExpression re(trans.get());
811 auto_ptr<XMLCh> trans2(fromUTF8(remote_user.c_str()));
812 if (re.matches(trans2.get())) {
813 request.log(SPRequest::SPDebug, string("htAccessControl plugin accepting user (") + w + ")");
817 catch (XMLException& ex) {
818 auto_ptr_char tmp(ex.getMessage());
819 request.log(SPRequest::SPError,
820 string("htAccessControl plugin caught exception while parsing regular expression (") + w + "): " + tmp.get());
823 else if (remote_user==w) {
824 request.log(SPRequest::SPDebug, string("htAccessControl plugin accepting user (") + w + ")");
829 else if (!strcmp(w,"group")) {
830 SH_AP_TABLE* grpstatus=NULL;
831 if (sta->m_dc->szAuthGrpFile && !remote_user.empty()) {
832 request.log(SPRequest::SPDebug,string("htAccessControl plugin using groups file: ") + sta->m_dc->szAuthGrpFile);
833 grpstatus=groups_for_user(sta->m_req,remote_user.c_str(),sta->m_dc->szAuthGrpFile);
839 w=ap_getword_conf(sta->m_req->pool,&t);
840 if (ap_table_get(grpstatus,w)) {
841 request.log(SPRequest::SPDebug, string("htAccessControl plugin accepting group (") + w + ")");
847 saml::Iterator<shibboleth::IAAP*> provs=dynamic_cast<const IApplication&>(request.getSPApplication()).getAAPProviders();
848 shibboleth::AAP wrapper(provs,w);
849 if (wrapper.fail()) {
850 request.log(SPRequest::SPWarn, string("htAccessControl plugin didn't recognize require rule: ") + w);
856 if (!strcmp(wrapper->getHeader(),"REMOTE_USER"))
857 vals=remote_user.c_str();
859 if (sta->m_dc->bUseEnvVars!=0) {
860 if (sta->m_rc && sta->m_rc->env) vals=ap_table_get(sta->m_rc->env,wrapper->getHeader());
863 vals=ap_table_get(sta->m_req->headers_in,wrapper->getHeader());
866 while (*t && vals && *vals) {
867 w=ap_getword_conf(sta->m_req->pool,&t);
874 auto_ptr<RegularExpression> re;
877 auto_ptr<XMLCh> trans(fromUTF8(w));
878 auto_ptr<RegularExpression> temp(new RegularExpression(trans.get()));
882 string vals_str(vals);
884 for (unsigned int i = 0; i < vals_str.length(); i++) {
885 if (vals_str.at(i) == ';') {
887 request.log(SPRequest::SPError, string("htAccessControl plugin found invalid header encoding (") +
888 vals + "): starts with a semicolon");
889 throw saml::SAMLException("Invalid information supplied to authorization plugin.");
892 if (vals_str.at(i-1) == '\\') {
893 vals_str.erase(i-1, 1);
898 string val = vals_str.substr(j, i-j);
901 auto_ptr<XMLCh> trans(fromUTF8(val.c_str()));
902 if (re->matches(trans.get())) {
903 request.log(SPRequest::SPDebug, string("htAccessControl plugin expecting ") + w +
904 ", got " + val + ": authorization granted");
908 else if ((wrapper->getCaseSensitive() && val==w) || (!wrapper->getCaseSensitive() && !strcasecmp(val.c_str(),w))) {
909 request.log(SPRequest::SPDebug, string("htAccessControl plugin expecting ") + w +
910 ", got " + val + ": authorization granted.");
914 request.log(SPRequest::SPDebug, string("htAccessControl plugin expecting ") + w +
915 ", got " + val + ": authoritzation not granted.");
920 string val = vals_str.substr(j, vals_str.length()-j);
922 auto_ptr<XMLCh> trans(fromUTF8(val.c_str()));
923 if (re->matches(trans.get())) {
924 request.log(SPRequest::SPDebug, string("htAccessControl plugin expecting ") + w +
925 ", got " + val + ": authorization granted.");
929 else if ((wrapper->getCaseSensitive() && val==w) || (!wrapper->getCaseSensitive() && !strcasecmp(val.c_str(),w))) {
930 request.log(SPRequest::SPDebug, string("htAccessControl plugin expecting ") + w +
931 ", got " + val + ": authorization granted");
935 request.log(SPRequest::SPDebug, string("htAccessControl plugin expecting ") + w +
936 ", got " + val + ": authorization not granted");
939 catch (XMLException& ex) {
940 auto_ptr_char tmp(ex.getMessage());
941 request.log(SPRequest::SPError, string("htAccessControl plugin caught exception while parsing regular expression (")
942 + w + "): " + tmp.get());
948 // check if all require directives are true
949 bool auth_all_OK = true;
950 for (int i= 0; i<reqs_arr->nelts; i++) {
951 auth_all_OK &= auth_OK[i];
953 if (auth_all_OK || !method_restricted)
959 #ifndef SHIB_APACHE_13
962 * Empty cleanup hook, Apache 2.x doesn't check NULL very well...
964 extern "C" apr_status_t shib_exit(void* data)
967 g_Config->shutdown();
970 ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,0,NULL,"shib_exit() done");
976 // Initial look at a request - create the per-request structure
977 static int shib_post_read(request_rec *r)
979 shib_request_config* rc = init_request_config(r);
981 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(r), "shib_post_read: E=%s", rc->env?"env":"hdr");
983 #ifdef SHIB_DEFERRED_HEADERS
984 rc->hdr_out = ap_make_table(r->pool, 5);
985 rc->hdr_err = ap_make_table(r->pool, 5);
990 // fixups: set environment vars
992 extern "C" int shib_fixups(request_rec* r)
994 shib_request_config *rc = (shib_request_config*)ap_get_module_config(r->request_config, &mod_shib);
995 shib_dir_config *dc = (shib_dir_config*)ap_get_module_config(r->per_dir_config, &mod_shib);
996 if (dc->bOff==1 || dc->bUseEnvVars==0)
999 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(r), "shib_fixup(%d): ENTER", (int)getpid());
1001 if (rc==NULL || rc->env==NULL || ap_is_empty_table(rc->env))
1004 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(r), "shib_fixup adding %d vars", ap_table_elts(rc->env)->nelts);
1005 r->subprocess_env = ap_overlay_tables(r->pool, r->subprocess_env, rc->env);
1012 * Cleanup the (per-process) pool info.
1014 #ifdef SHIB_APACHE_13
1015 extern "C" void shib_child_exit(server_rec* s, SH_AP_POOL* p)
1018 extern "C" apr_status_t shib_child_exit(void* data)
1020 server_rec* s = NULL;
1023 ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(s),"shib_child_exit(%d) dealing with g_Config..", (int)getpid());
1024 g_Config->shutdown();
1026 ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(s),"shib_child_exit() done");
1028 #ifndef SHIB_APACHE_13
1034 * shire_child_init()
1035 * Things to do when the child process is initialized.
1036 * (or after the configs are read in apache-2)
1038 #ifdef SHIB_APACHE_13
1039 extern "C" void shib_child_init(server_rec* s, SH_AP_POOL* p)
1041 extern "C" void shib_child_init(apr_pool_t* p, server_rec* s)
1044 // Initialize runtime components.
1046 ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(s),"shib_child_init(%d) starting", (int)getpid());
1049 ap_log_error(APLOG_MARK,APLOG_ERR|APLOG_NOERRNO,SH_AP_R(s),"shib_child_init() already initialized!");
1054 g_Config=&ShibTargetConfig::getConfig();
1055 SPConfig::getConfig().setFeatures(
1057 SPConfig::Listener |
1058 SPConfig::Metadata |
1060 SPConfig::RequestMapping |
1061 SPConfig::InProcess |
1064 if (!g_Config->init(g_szSchemaDir)) {
1065 ap_log_error(APLOG_MARK,APLOG_CRIT|APLOG_NOERRNO,SH_AP_R(s),"shib_child_init() failed to initialize libraries");
1068 SPConfig::getConfig().AccessControlManager.registerFactory(HT_ACCESS_CONTROL,&htAccessFactory);
1069 SPConfig::getConfig().RequestMapperManager.registerFactory(NATIVE_REQUEST_MAPPER,&ApacheRequestMapFactory);
1071 if (!g_Config->load(g_szSHIBConfig)) {
1072 ap_log_error(APLOG_MARK,APLOG_CRIT|APLOG_NOERRNO,SH_AP_R(s),"shib_child_init() failed to load configuration");
1076 IConfig* conf=g_Config->getINI();
1077 xmltooling::Locker locker(conf);
1078 const PropertySet* props=conf->getPropertySet("Local");
1080 pair<bool,const char*> unsetValue=props->getString("unsetHeaderValue");
1081 if (unsetValue.first)
1082 g_unsetHeaderValue = unsetValue.second;
1086 ap_log_error(APLOG_MARK,APLOG_CRIT|APLOG_NOERRNO,SH_AP_R(s),"shib_child_init() failed to initialize system");
1090 // Set the cleanup handler
1091 apr_pool_cleanup_register(p, NULL, &shib_exit, &shib_child_exit);
1093 ap_log_error(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(s),"shib_child_init() done");
1097 #ifdef SHIB_DEFERRED_HEADERS
1098 static void set_output_filter(request_rec *r)
1100 ap_add_output_filter("SHIB_HEADERS_OUT", NULL, r, r->connection);
1103 static void set_error_filter(request_rec *r)
1105 ap_add_output_filter("SHIB_HEADERS_ERR", NULL, r, r->connection);
1108 static apr_status_t do_output_filter(ap_filter_t *f, apr_bucket_brigade *in)
1110 request_rec *r = f->r;
1111 shib_request_config *rc = (shib_request_config*) ap_get_module_config(r->request_config, &mod_shib);
1114 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(r),"shib_out_filter: merging %d headers", apr_table_elts(rc->hdr_out)->nelts);
1115 apr_table_overlap(r->headers_out, rc->hdr_out, APR_OVERLAP_TABLES_MERGE);
1118 /* remove ourselves from the filter chain */
1119 ap_remove_output_filter(f);
1121 /* send the data up the stack */
1122 return ap_pass_brigade(f->next,in);
1125 static apr_status_t do_error_filter(ap_filter_t *f, apr_bucket_brigade *in)
1127 request_rec *r = f->r;
1128 shib_request_config *rc = (shib_request_config*) ap_get_module_config(r->request_config, &mod_shib);
1131 ap_log_rerror(APLOG_MARK,APLOG_DEBUG|APLOG_NOERRNO,SH_AP_R(r),"shib_err_filter: merging %d headers", apr_table_elts(rc->hdr_err)->nelts);
1132 apr_table_overlap(r->err_headers_out, rc->hdr_err, APR_OVERLAP_TABLES_MERGE);
1135 /* remove ourselves from the filter chain */
1136 ap_remove_output_filter(f);
1138 /* send the data up the stack */
1139 return ap_pass_brigade(f->next,in);
1141 #endif // SHIB_DEFERRED_HEADERS
1143 typedef const char* (*config_fn_t)(void);
1145 #ifdef SHIB_APACHE_13
1147 // SHIB Module commands
1149 static command_rec shire_cmds[] = {
1150 {"ShibConfig", (config_fn_t)ap_set_global_string_slot, &g_szSHIBConfig,
1151 RSRC_CONF, TAKE1, "Path to shibboleth.xml config file"},
1152 {"ShibSchemaDir", (config_fn_t)ap_set_global_string_slot, &g_szSchemaDir,
1153 RSRC_CONF, TAKE1, "Path to Shibboleth XML schema directory"},
1155 {"ShibURLScheme", (config_fn_t)shib_set_server_string_slot,
1156 (void *) XtOffsetOf (shib_server_config, szScheme),
1157 RSRC_CONF, TAKE1, "URL scheme to force into generated URLs for a vhost"},
1159 {"ShibDisable", (config_fn_t)ap_set_flag_slot,
1160 (void *) XtOffsetOf (shib_dir_config, bOff),
1161 OR_AUTHCFG, FLAG, "Disable all Shib module activity here to save processing effort"},
1162 {"ShibApplicationId", (config_fn_t)ap_set_string_slot,
1163 (void *) XtOffsetOf (shib_dir_config, szApplicationId),
1164 OR_AUTHCFG, TAKE1, "Set Shibboleth applicationId property for content"},
1165 {"ShibBasicHijack", (config_fn_t)ap_set_flag_slot,
1166 (void *) XtOffsetOf (shib_dir_config, bBasicHijack),
1167 OR_AUTHCFG, FLAG, "Respond to AuthType Basic and convert to shibboleth"},
1168 {"ShibRequireSession", (config_fn_t)ap_set_flag_slot,
1169 (void *) XtOffsetOf (shib_dir_config, bRequireSession),
1170 OR_AUTHCFG, FLAG, "Initiates a new session if one does not exist"},
1171 {"ShibRequireSessionWith", (config_fn_t)ap_set_string_slot,
1172 (void *) XtOffsetOf (shib_dir_config, szRequireWith),
1173 OR_AUTHCFG, TAKE1, "Initiates a new session if one does not exist using a specific SessionInitiator"},
1174 {"ShibExportAssertion", (config_fn_t)ap_set_flag_slot,
1175 (void *) XtOffsetOf (shib_dir_config, bExportAssertion),
1176 OR_AUTHCFG, FLAG, "Export SAML attribute assertion(s) to Shib-Attributes header"},
1177 {"ShibRedirectToSSL", (config_fn_t)ap_set_string_slot,
1178 (void *) XtOffsetOf (shib_dir_config, szRedirectToSSL),
1179 OR_AUTHCFG, TAKE1, "Redirect non-SSL requests to designated port" },
1180 {"AuthGroupFile", (config_fn_t)shib_ap_set_file_slot,
1181 (void *) XtOffsetOf (shib_dir_config, szAuthGrpFile),
1182 OR_AUTHCFG, TAKE1, "text file containing group names and member user IDs"},
1183 {"ShibRequireAll", (config_fn_t)ap_set_flag_slot,
1184 (void *) XtOffsetOf (shib_dir_config, bRequireAll),
1185 OR_AUTHCFG, FLAG, "All require directives must match"},
1186 {"ShibUseEnvironment", (config_fn_t)ap_set_flag_slot,
1187 (void *) XtOffsetOf (shib_dir_config, bUseEnvVars),
1188 OR_AUTHCFG, FLAG, "Export data in environment instead of headers (default)"},
1194 handler_rec shib_handlers[] = {
1195 { "shib-handler", shib_handler },
1199 module MODULE_VAR_EXPORT mod_shib = {
1200 STANDARD_MODULE_STUFF,
1201 NULL, /* initializer */
1202 create_shib_dir_config, /* dir config creater */
1203 merge_shib_dir_config, /* dir merger --- default is to override */
1204 create_shib_server_config, /* server config */
1205 merge_shib_server_config, /* merge server config */
1206 shire_cmds, /* command table */
1207 shib_handlers, /* handlers */
1208 NULL, /* filename translation */
1209 shib_check_user, /* check_user_id */
1210 shib_auth_checker, /* check auth */
1211 NULL, /* check access */
1212 NULL, /* type_checker */
1213 shib_fixups, /* fixups */
1215 NULL, /* header parser */
1216 shib_child_init, /* child_init */
1217 shib_child_exit, /* child_exit */
1218 shib_post_read /* post read-request */
1221 #elif defined(SHIB_APACHE_20) || defined(SHIB_APACHE_22)
1223 extern "C" void shib_register_hooks (apr_pool_t *p)
1225 #ifdef SHIB_DEFERRED_HEADERS
1226 ap_register_output_filter("SHIB_HEADERS_OUT", do_output_filter, NULL, AP_FTYPE_CONTENT_SET);
1227 ap_hook_insert_filter(set_output_filter, NULL, NULL, APR_HOOK_LAST);
1228 ap_register_output_filter("SHIB_HEADERS_ERR", do_error_filter, NULL, AP_FTYPE_CONTENT_SET);
1229 ap_hook_insert_error_filter(set_error_filter, NULL, NULL, APR_HOOK_LAST);
1230 ap_hook_post_read_request(shib_post_read, NULL, NULL, APR_HOOK_MIDDLE);
1232 ap_hook_child_init(shib_child_init, NULL, NULL, APR_HOOK_MIDDLE);
1233 ap_hook_check_user_id(shib_check_user, NULL, NULL, APR_HOOK_MIDDLE);
1234 ap_hook_auth_checker(shib_auth_checker, NULL, NULL, APR_HOOK_FIRST);
1235 ap_hook_handler(shib_handler, NULL, NULL, APR_HOOK_LAST);
1236 ap_hook_fixups(shib_fixups, NULL, NULL, APR_HOOK_MIDDLE);
1239 // SHIB Module commands
1242 static command_rec shib_cmds[] = {
1243 AP_INIT_TAKE1("ShibConfig",
1244 (config_fn_t)ap_set_global_string_slot, &g_szSHIBConfig,
1245 RSRC_CONF, "Path to shibboleth.xml config file"),
1246 AP_INIT_TAKE1("ShibSchemaDir",
1247 (config_fn_t)ap_set_global_string_slot, &g_szSchemaDir,
1248 RSRC_CONF, "Path to Shibboleth XML schema directory"),
1250 AP_INIT_TAKE1("ShibURLScheme",
1251 (config_fn_t)shib_set_server_string_slot,
1252 (void *) offsetof (shib_server_config, szScheme),
1253 RSRC_CONF, "URL scheme to force into generated URLs for a vhost"),
1255 AP_INIT_FLAG("ShibDisable", (config_fn_t)ap_set_flag_slot,
1256 (void *) offsetof (shib_dir_config, bOff),
1257 OR_AUTHCFG, "Disable all Shib module activity here to save processing effort"),
1258 AP_INIT_TAKE1("ShibApplicationId", (config_fn_t)ap_set_string_slot,
1259 (void *) offsetof (shib_dir_config, szApplicationId),
1260 OR_AUTHCFG, "Set Shibboleth applicationId property for content"),
1261 AP_INIT_FLAG("ShibBasicHijack", (config_fn_t)ap_set_flag_slot,
1262 (void *) offsetof (shib_dir_config, bBasicHijack),
1263 OR_AUTHCFG, "Respond to AuthType Basic and convert to shibboleth"),
1264 AP_INIT_FLAG("ShibRequireSession", (config_fn_t)ap_set_flag_slot,
1265 (void *) offsetof (shib_dir_config, bRequireSession),
1266 OR_AUTHCFG, "Initiates a new session if one does not exist"),
1267 AP_INIT_TAKE1("ShibRequireSessionWith", (config_fn_t)ap_set_string_slot,
1268 (void *) offsetof (shib_dir_config, szRequireWith),
1269 OR_AUTHCFG, "Initiates a new session if one does not exist using a specific SessionInitiator"),
1270 AP_INIT_FLAG("ShibExportAssertion", (config_fn_t)ap_set_flag_slot,
1271 (void *) offsetof (shib_dir_config, bExportAssertion),
1272 OR_AUTHCFG, "Export SAML attribute assertion(s) to Shib-Attributes header"),
1273 AP_INIT_TAKE1("ShibRedirectToSSL", (config_fn_t)ap_set_string_slot,
1274 (void *) offsetof (shib_dir_config, szRedirectToSSL),
1275 OR_AUTHCFG, "Redirect non-SSL requests to designated port"),
1276 AP_INIT_TAKE1("AuthGroupFile", (config_fn_t)shib_ap_set_file_slot,
1277 (void *) offsetof (shib_dir_config, szAuthGrpFile),
1278 OR_AUTHCFG, "Text file containing group names and member user IDs"),
1279 AP_INIT_FLAG("ShibRequireAll", (config_fn_t)ap_set_flag_slot,
1280 (void *) offsetof (shib_dir_config, bRequireAll),
1281 OR_AUTHCFG, "All require directives must match"),
1282 AP_INIT_FLAG("ShibUseEnvironment", (config_fn_t)ap_set_flag_slot,
1283 (void *) offsetof (shib_dir_config, bUseEnvVars),
1284 OR_AUTHCFG, "Export data in environment instead of headers (default)"),
1289 module AP_MODULE_DECLARE_DATA mod_shib = {
1290 STANDARD20_MODULE_STUFF,
1291 create_shib_dir_config, /* create dir config */
1292 merge_shib_dir_config, /* merge dir config --- default is to override */
1293 create_shib_server_config, /* create server config */
1294 merge_shib_server_config, /* merge server config */
1295 shib_cmds, /* command table */
1296 shib_register_hooks /* register hooks */
1300 #error "undefined APACHE version"