Bzs.Server.CloudServices.AppService.GetCredentialsFromRequest C# (CSharp) Метод

GetCredentialsFromRequest() приватный Метод

Returns the credentials from the request.
private GetCredentialsFromRequest ( ) : AccountPassword
Результат Bzs.Server.CloudServices.Authorization.AccountPassword
        private AccountPassword GetCredentialsFromRequest()
        {
            if (WebOperationContext.Current != null)
            {
                foreach (object header in HttpContext.Current.Request.Headers)
                {
                    if (header.ToString() == "Authorization")
                    {
                        string headerItem = HttpContext.Current.Request.Headers[header.ToString()];
                        if (headerItem.StartsWith("Basic "))
                        {
                            string cred = Encoding.UTF8.GetString(Convert.FromBase64String(headerItem.Substring("Basic ".Length)));
                            string[] parts = cred.Split(':');
                            return new AccountPassword(parts[0], parts[1]);
                        }
                    }
                }
            }

            throw new AuthenticationException();
        }