X-Git-Url: http://www.project-moonshot.org/gitweb/?p=shibboleth%2Fsp.git;a=blobdiff_plain;f=shibsp%2FServiceProvider.cpp;h=b3589489c2d5d71ae5ad43f46b69717ee3a38c18;hp=30e4423cc304d269532f262da2605717dc76aca5;hb=a0af8ed86ab481af4605daf5cf837fdaa4544bdd;hpb=ef5033b9317ef36b5e3b99679cf789e93d8b6654 diff --git a/shibsp/ServiceProvider.cpp b/shibsp/ServiceProvider.cpp index 30e4423..b358948 100644 --- a/shibsp/ServiceProvider.cpp +++ b/shibsp/ServiceProvider.cpp @@ -163,6 +163,7 @@ void SHIBSP_API shibsp::registerServiceProviders() ServiceProvider::ServiceProvider() { + m_authTypes.insert("shibboleth"); } ServiceProvider::~ServiceProvider() @@ -266,16 +267,18 @@ pair ServiceProvider::doAuthentication(SPRequest& request, bool handl pair requireSession = settings.first->getBool("requireSession"); pair requireSessionWith = settings.first->getString("requireSessionWith"); - // If no session is required AND the AuthType (an Apache-derived concept) isn't shibboleth, + string lcAuthType; + if (authType.first) { + while (*authType.second) + lcAuthType += tolower(*authType.second++); + } + + // If no session is required AND the AuthType (an Apache-derived concept) isn't recognized, // then we ignore this request and consider it unprotected. Apache might lie to us if // ShibBasicHijack is on, but that's up to it. if ((!requireSession.first || !requireSession.second) && !requireSessionWith.first && -#ifdef HAVE_STRCASECMP - (!authType.first || strcasecmp(authType.second,"shibboleth"))) -#else - (!authType.first || _stricmp(authType.second,"shibboleth"))) -#endif - return make_pair(true,request.returnDecline()); + (!authType.first || m_authTypes.find(lcAuthType) == m_authTypes.end())) + return make_pair(true, request.returnDecline()); // Fix for secadv 20050901 clearHeaders(request); @@ -315,7 +318,7 @@ pair ServiceProvider::doAuthentication(SPRequest& request, bool handl return initiator->run(request,false); } - request.setAuthType("shibboleth"); + request.setAuthType(lcAuthType.c_str()); // We're done. Everything is okay. Nothing to report. Nothing to do.. // Let the caller decide how to proceed. @@ -349,16 +352,18 @@ pair ServiceProvider::doAuthorization(SPRequest& request) const pair requireSession = settings.first->getBool("requireSession"); pair requireSessionWith = settings.first->getString("requireSessionWith"); - // If no session is required AND the AuthType (an Apache-derived concept) isn't shibboleth, + string lcAuthType; + if (authType.first) { + while (*authType.second) + lcAuthType += tolower(*authType.second++); + } + + // If no session is required AND the AuthType (an Apache-derived concept) isn't recognized, // then we ignore this request and consider it unprotected. Apache might lie to us if // ShibBasicHijack is on, but that's up to it. if ((!requireSession.first || !requireSession.second) && !requireSessionWith.first && -#ifdef HAVE_STRCASECMP - (!authType.first || strcasecmp(authType.second,"shibboleth"))) -#else - (!authType.first || _stricmp(authType.second,"shibboleth"))) -#endif - return make_pair(true,request.returnDecline()); + (!authType.first || m_authTypes.find(lcAuthType) == m_authTypes.end())) + return make_pair(true, request.returnDecline()); // Do we have an access control plugin? if (settings.second) {