- option = request.getParameter("target");
- if (option)
- target = option;
- recoverRelayState(request.getApplication(), request, target, false);
+ prop = getString("target", request);
+ if (prop.first)
+ target = prop.second;
+
+ // Since we're passing the ACS by value, we need to compute the return URL,
+ // so we'll need the target resource for real.
+ recoverRelayState(request.getApplication(), request, request, target, false);
+ request.getApplication().limitRedirect(request, target.c_str());
+
+ prop.second = request.getParameter("discoveryURL");
+ if (prop.second && *prop.second)
+ discoveryURL.second = prop.second;