X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=adfs%2Fadfs.cpp;h=b2be93ba107d22b8e285ae26a7d0afdb9b86ce65;hb=392d1448deb48beb75f219532ac248b4776f16db;hp=98c905efc82be6f7816ca4f7256d2528705e7398;hpb=eae1fe1d3c2240c2205eedd47b507e07d2f09d25;p=shibboleth%2Fsp.git diff --git a/adfs/adfs.cpp b/adfs/adfs.cpp index 98c905e..b2be93b 100644 --- a/adfs/adfs.cpp +++ b/adfs/adfs.cpp @@ -437,19 +437,23 @@ pair ADFSSessionInitiator::doRequest( MetadataProvider::Criteria mc(entityID, &IDPSSODescriptor::ELEMENT_QNAME, m_binding.get()); pair entity=m->getEntityDescriptor(mc); if (!entity.first) { - m_log.error("unable to locate metadata for provider (%s)", entityID); + m_log.warn("unable to locate metadata for provider (%s)", entityID); throw MetadataException("Unable to locate metadata for identity provider ($entityID)", namedparams(1, "entityID", entityID)); } else if (!entity.second) { - m_log.error("unable to locate ADFS-aware identity provider role for provider (%s)", entityID); - return make_pair(false,0L); + m_log.warn("unable to locate ADFS-aware identity provider role for provider (%s)", entityID); + if (getParent()) + return make_pair(false,0L); + throw MetadataException("Unable to locate ADFS-aware identity provider role for provider ($entityID)", namedparams(1, "entityID", entityID)); } const EndpointType* ep = EndpointManager( dynamic_cast(entity.second)->getSingleSignOnServices() ).getByBinding(m_binding.get()); if (!ep) { - m_log.error("unable to locate compatible SSO service for provider (%s)", entityID); - return make_pair(false,0L); + m_log.warn("unable to locate compatible SSO service for provider (%s)", entityID); + if (getParent()) + return make_pair(false,0L); + throw MetadataException("Unable to locate compatible SSO service for provider ($entityID)", namedparams(1, "entityID", entityID)); } preserveRelayState(app, httpResponse, relayState); @@ -562,10 +566,12 @@ void ADFSConsumer::implementProtocol( if (!policy.isAuthenticated()) throw SecurityPolicyException("Unable to establish security of incoming assertion."); + const EntityDescriptor* entity = policy.getIssuerMetadata() ? dynamic_cast(policy.getIssuerMetadata()->getParent()) : NULL; + // Now do profile and core semantic validation to ensure we can use it for SSO. // Profile validator. time_t now = time(NULL); - saml1::AssertionValidator ssoValidator(application.getAudiences(), now); + saml1::AssertionValidator ssoValidator(application.getRelyingParty(entity)->getXMLString("entityID").second, application.getAudiences(), now); ssoValidator.validateAssertion(*token); if (!token->getConditions() || !token->getConditions()->getNotBefore() || !token->getConditions()->getNotOnOrAfter()) throw FatalProfileException("Assertion did not contain time conditions."); @@ -579,7 +585,7 @@ void ADFSConsumer::implementProtocol( // authnskew allows rejection of SSO if AuthnInstant is too old. const PropertySet* sessionProps = application.getPropertySet("Sessions"); - pair authnskew = sessionProps ? sessionProps->getUnsignedInt("authnskew") : pair(false,0); + pair authnskew = sessionProps ? sessionProps->getUnsignedInt("maxTimeSinceAuthn") : pair(false,0); if (authnskew.first && authnskew.second && ssoStatement->getAuthenticationInstant() && (now - ssoStatement->getAuthenticationInstantEpoch() > authnskew.second)) @@ -634,11 +640,11 @@ void ADFSConsumer::implementProtocol( } application.getServiceProvider().getSessionCache()->insert( - now + lifetime.second, application, httpRequest, httpResponse, - policy.getIssuerMetadata() ? dynamic_cast(policy.getIssuerMetadata()->getParent()) : NULL, + now + lifetime.second, + entity, m_protocol.get(), nameid.get(), ssoStatement->getAuthenticationInstant() ? ssoStatement->getAuthenticationInstant()->getRawData() : NULL, @@ -802,12 +808,12 @@ pair ADFSLogout::run(SPRequest& request, bool isHandler) const } // Best effort on back channel and to remove the user agent's session. - string session_id = app.getServiceProvider().getSessionCache()->active(request, app); + string session_id = app.getServiceProvider().getSessionCache()->active(app, request); if (!session_id.empty()) { vector sessions(1,session_id); notifyBackChannel(app, request.getRequestURL(), sessions, false); try { - app.getServiceProvider().getSessionCache()->remove(request, &request, app); + app.getServiceProvider().getSessionCache()->remove(app, request, &request); } catch (exception& ex) { m_log.error("error removing session (%s): %s", session_id.c_str(), ex.what()); @@ -816,5 +822,5 @@ pair ADFSLogout::run(SPRequest& request, bool isHandler) const if (param) return make_pair(true, request.sendRedirect(param)); - return sendLogoutPage(app, request, false, "Logout complete."); + return sendLogoutPage(app, request, request, false, "Logout complete."); }