public bool AuthenticateRequest([NotNull] HttpContext context)
{
if (context == null)
throw FacebookApi.Nre("context");
bool saveSession = true;
string code = context.Request.QueryString["code"];
if (!String.IsNullOrEmpty(code))
{
Authenticate(code, GetCurrentUrl(context));
}
else
{
ISessionStorage ss = SessionStorage;
if (ss != null)
{
_fbSession = ss.Session;
if (_fbSession != null
&& !ss.IsSecure
&& _fbSession.Signature != GenerateSignature(_fbSession.ToJsonObject()))
{
_fbSession = null;
}
saveSession = _fbSession == null;
}
}
if (saveSession)
SaveSession(context);
return _fbSession != null;
}