MAINT-5711 FIX2 auto login for profiles - final part retrieves the URL to set cookie for
from the message sent over by login.cgimeow-7.2.2
parent
2a899b49dd
commit
c16e726d0e
|
|
@ -178,6 +178,11 @@ void LLCurl::Responder::setURL(const std::string& url)
|
|||
mURL = url;
|
||||
}
|
||||
|
||||
const std::string& LLCurl::Responder::getURL()
|
||||
{
|
||||
return mURL;
|
||||
}
|
||||
|
||||
void LLCurl::Responder::successResult(const LLSD& content)
|
||||
{
|
||||
setResult(HTTP_OK, "", content);
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ public:
|
|||
public:
|
||||
void setHTTPMethod(EHTTPMethod method);
|
||||
void setURL(const std::string& url);
|
||||
const std::string& Responder::getURL();
|
||||
void setResult(S32 status, const std::string& reason, const LLSD& content = LLSD());
|
||||
void setResponseHeader(const std::string& header, const std::string& value);
|
||||
|
||||
|
|
|
|||
|
|
@ -285,13 +285,16 @@ public:
|
|||
const LLChannelDescriptors& channels,
|
||||
const LLIOPipe::buffer_ptr_t& buffer)
|
||||
{
|
||||
const std::string url = getURL();
|
||||
llinfos << "@@@ URL to set cookie on" << url << llendl;
|
||||
|
||||
// We don't care about the content of the response, only the Set-Cookie header.
|
||||
LL_DEBUGS("MediaAuth") << dumpResponse()
|
||||
<< " [headers:" << getResponseHeaders() << "]" << LL_ENDL;
|
||||
llinfos << dumpResponse()
|
||||
<< " [headers:" << getResponseHeaders() << "]" << llendl;
|
||||
const std::string& cookie = getResponseHeader(HTTP_IN_HEADER_SET_COOKIE);
|
||||
|
||||
// *TODO: What about bad status codes? Does this destroy previous cookies?
|
||||
LLViewerMedia::openIDCookieResponse(cookie);
|
||||
LLViewerMedia::openIDCookieResponse(url, cookie);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
@ -1200,7 +1203,7 @@ void LLViewerMedia::clearAllCookies()
|
|||
}
|
||||
|
||||
// If we have an OpenID cookie, re-add it to the cookie store.
|
||||
setOpenIDCookie();
|
||||
setOpenIDCookie(std::string());
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1303,7 +1306,7 @@ void LLViewerMedia::loadCookieFile()
|
|||
}
|
||||
|
||||
// If we have an OpenID cookie, re-add it to the cookie store.
|
||||
setOpenIDCookie();
|
||||
setOpenIDCookie(std::string());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1413,7 +1416,7 @@ bool LLViewerMedia::parseRawCookie(const std::string raw_cookie, std::string& na
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// static
|
||||
void LLViewerMedia::setOpenIDCookie()
|
||||
void LLViewerMedia::setOpenIDCookie(const std::string& url)
|
||||
{
|
||||
if(!sOpenIDCookie.empty())
|
||||
{
|
||||
|
|
@ -1442,19 +1445,21 @@ void LLViewerMedia::setOpenIDCookie()
|
|||
|
||||
getCookieStore()->setCookiesFromHost(sOpenIDCookie, authority.substr(host_start, host_end - host_start));
|
||||
|
||||
LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
|
||||
if (media_instance)
|
||||
{
|
||||
std::string cookie_host = authority.substr(host_start, host_end - host_start);
|
||||
std::string cookie_name = "";
|
||||
std::string cookie_value = "";
|
||||
std::string cookie_path = "";
|
||||
if (parseRawCookie(sOpenIDCookie, cookie_name, cookie_value, cookie_path))
|
||||
if (url.length())
|
||||
{
|
||||
LLMediaCtrl* media_instance = LLFloaterReg::getInstance("destinations")->getChild<LLMediaCtrl>("destination_guide_contents");
|
||||
if (media_instance)
|
||||
{
|
||||
std::string url = "http://id.secondlife.com/openid/webkit";
|
||||
media_instance->getMediaPlugin()->setCookie(url, cookie_name, cookie_value, cookie_host, cookie_path);
|
||||
std::string cookie_host = authority.substr(host_start, host_end - host_start);
|
||||
std::string cookie_name = "";
|
||||
std::string cookie_value = "";
|
||||
std::string cookie_path = "";
|
||||
if (parseRawCookie(sOpenIDCookie, cookie_name, cookie_value, cookie_path))
|
||||
{
|
||||
media_instance->getMediaPlugin()->setCookie(url, cookie_name, cookie_value, cookie_host, cookie_path);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// NOTE: this is the original OpenID cookie code, so of which is no longer needed now that we
|
||||
// are using CEF - it's very intertwined with other code so, for the moment, I'm going to
|
||||
|
|
@ -1514,13 +1519,13 @@ void LLViewerMedia::openIDSetup(const std::string &openid_url, const std::string
|
|||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
// static
|
||||
void LLViewerMedia::openIDCookieResponse(const std::string &cookie)
|
||||
void LLViewerMedia::openIDCookieResponse(const std::string& url, const std::string &cookie)
|
||||
{
|
||||
LL_DEBUGS("MediaAuth") << "Cookie received: \"" << cookie << "\"" << LL_ENDL;
|
||||
|
||||
sOpenIDCookie += cookie;
|
||||
|
||||
setOpenIDCookie();
|
||||
setOpenIDCookie(url);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public:
|
|||
static void removeCookie(const std::string &name, const std::string &domain, const std::string &path = std::string("/") );
|
||||
|
||||
static void openIDSetup(const std::string &openid_url, const std::string &openid_token);
|
||||
static void openIDCookieResponse(const std::string &cookie);
|
||||
static void openIDCookieResponse(const std::string& url, const std::string &cookie);
|
||||
|
||||
static void proxyWindowOpened(const std::string &target, const std::string &uuid);
|
||||
static void proxyWindowClosed(const std::string &uuid);
|
||||
|
|
@ -164,7 +164,7 @@ public:
|
|||
|
||||
private:
|
||||
static bool parseRawCookie(const std::string raw_cookie, std::string& name, std::string& value, std::string& path);
|
||||
static void setOpenIDCookie();
|
||||
static void setOpenIDCookie(const std::string& url);
|
||||
static void onTeleportFinished();
|
||||
|
||||
static LLPluginCookieStore *sCookieStore;
|
||||
|
|
|
|||
Loading…
Reference in New Issue