{
// We have to know the IdP to function.
if (!entityID || !*entityID)
- return make_pair(false,0);
+ return make_pair(false,0L);
string target;
const Handler* ACS=NULL;
const vector<const Handler*>& handlers = app.getAssertionConsumerServicesByBinding(m_binding.get());
// Index comes from request, or default set in the handler, or we just pick the first endpoint.
- pair<bool,unsigned int> index = make_pair(false,0);
+ pair<bool,unsigned int> index(false,0);
if (isHandler) {
option = request.getParameter("acsIndex");
if (option)
- index = make_pair(true, atoi(option));
+ index = pair<bool,unsigned int>(true, atoi(option));
}
if (!index.first)
index = getUnsignedInt("defaultACSIndex");
}
else if (!entity.second) {
m_log.error("unable to locate ADFS-aware identity provider role for provider (%s)", entityID);
- return make_pair(false,0);
+ return make_pair(false,0L);
}
const EndpointType* ep = EndpointManager<SingleSignOnService>(
dynamic_cast<const IDPSSODescriptor*>(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,0);
+ return make_pair(false,0L);
}
preserveRelayState(app, httpResponse, relayState);
return make_pair(true, httpResponse.sendRedirect(req.c_str()));
#else
- return make_pair(false,0);
+ return make_pair(false,0L);
#endif
}
throw FatalProfileException("Assertion did not contain time conditions.");
else if (token->getAuthenticationStatements().empty())
throw FatalProfileException("Assertion did not contain an authentication statement.");
+
// With ADFS, we only have one token, but we need to put it in a vector.
vector<const Assertion*> tokens(1,token);
const saml1::AuthenticationStatement* ssoStatement=token->getAuthenticationStatements().front();
+ // authnskew allows rejection of SSO if AuthnInstant is too old.
+ const PropertySet* sessionProps = application.getPropertySet("Sessions");
+ pair<bool,unsigned int> authnskew = sessionProps ? sessionProps->getUnsignedInt("authnskew") : pair<bool,unsigned int>(false,0);
+
+ if (authnskew.first && authnskew.second &&
+ ssoStatement->getAuthenticationInstant() && (now - ssoStatement->getAuthenticationInstantEpoch() > authnskew.second))
+ throw FatalProfileException("The gap between now and the time you logged into your identity provider exceeds the limit.");
+
// Address checking.
saml1::SubjectLocality* locality = ssoStatement->getSubjectLocality();
if (locality && locality->getIPAddress()) {
// Now we have to extract the authentication details for attribute and session setup.
// Session expiration for ADFS is purely SP-driven, and the method is mapped to a ctx class.
- const PropertySet* sessionProps = application.getPropertySet("Sessions");
pair<bool,unsigned int> lifetime = sessionProps ? sessionProps->getUnsignedInt("lifetime") : pair<bool,unsigned int>(true,28800);
if (!lifetime.first || lifetime.second == 0)
lifetime.second = 28800;
try {
session = request.getSession(false, true, false); // don't cache it and ignore all checks
if (!session)
- return make_pair(false,0);
+ return make_pair(false,0L);
// We only handle ADFS sessions.
if (!XMLString::equals(session->getProtocol(), WSFED_NS) || !session->getEntityID()) {
session->unlock();
- return make_pair(false,0);
+ return make_pair(false,0L);
}
}
catch (exception& ex) {
m_log.error("error accessing current session: %s", ex.what());
- return make_pair(false,0);
+ return make_pair(false,0L);
}
string entityID(session->getEntityID());
m_log.error("error issuing ADFS logout request: %s", ex.what());
}
- return make_pair(false,0);
+ return make_pair(false,0L);
#else
throw ConfigurationException("Cannot perform logout using lite version of shibsp library.");
#endif