This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void OnAuthenticateRequest(object source, EventArgs args) { | |
HttpContext httpContext = HttpContext.Current; | |
if (httpContext.Request.IsAuthenticated) { | |
if (string.IsNullOrEmpty(httpContext.Request.Headers["X-CommonAccessToken"])) { | |
Uri url = httpContext.Request.Url; | |
Exception ex = null; | |
CommonAccessToken commonAccessToken = CommonAccessTokenFromUrl(httpContext. | |
User.Identity.ToString(), url, out ex); | |
} | |
} | |
} | |
private static CommonAccessToken CommonAccessTokenFromUrl(string user, Uri requestURI, out Exception ex) { | |
ex = null; | |
CommonAccessToken result = null; | |
string text = LiveIdBasicAuthModule.GetNameValueCollectionFromUri(requestURI).Get("X-Rps-CAT"); | |
if (!string.IsNullOrWhiteSpace(text)) { | |
try { | |
result = CommonAccessToken.Deserialize(Uri.UnescapeDataString(text)); | |
} catch (Exception ex2) { | |
// handle exception here | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment