private string GetAuthorizationToken(OwinEnvironment env)
        {
            string result = null;
            var    auth   = env.GetRequestHeader("Authorization", (string)null);

            if (auth != null)
            {
                var md = System.Text.RegularExpressions.Regex.Match(
                    auth,
                    @"\s*Basic (\S+)", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                if (md.Success)
                {
                    result = md.Groups[1].Value;
                }
            }
            if (result == null)
            {
                var query = env.GetQueryParameters();
                query.TryGetValue("auth", out result);
            }
            if (result == null)
            {
                var cookies = env.GetRequestCookies();
                cookies.TryGetValue("auth", out result);
            }
            return(result);
        }
Beispiel #2
0
 public string Get(string key)
 {
     return(env.GetRequestHeader(key, (string)null));
 }