コード例 #1
0
 public AccountIdentifier(IStorageAccount account, SecretKeyPermissions keyUsedPermissions)
 {
     if (account == null)
     {
         throw new ArgumentNullException("account", "account cannot be null");
     }
     NephosAssertionException.Assert(account.Permissions.HasValue, "account.Permissions cannot be null");
     this.AccountName        = account.Name;
     this.IsSecondaryAccess  = account.IsSecondaryAccess;
     this.Permissions        = account.Permissions.Value;
     this.KeyUsedPermissions = keyUsedPermissions;
 }
コード例 #2
0
 private void JustDecompileGenerated_set_KeyUsedPermissions(SecretKeyPermissions value)
 {
     this.JustDecompileGenerated_KeyUsedPermissions_k__BackingField = value;
 }
コード例 #3
0
 public AccountIdentifier(string accountName, bool accountIsAdmin, AccountPermissions accountPermissions, SecretKeyPermissions keyPermissions, bool isAnonymous)
 {
     this.AccountName        = accountName;
     this.IsAdmin            = accountIsAdmin;
     this.Permissions        = accountPermissions;
     this.KeyUsedPermissions = keyPermissions;
     this.IsAnonymous        = new bool?(isAnonymous);
 }
コード例 #4
0
 public AuthDataEntry(string keyName, byte[] authValue, SecretKeyPermissions permissions)
 {
     this.keyName     = keyName;
     this.authValue   = authValue;
     this.permissions = permissions;
 }
コード例 #5
0
 public AccountSasAccessIdentifier(IStorageAccount account, SecretKeyPermissions keyPermission) : base(account, keyPermission)
 {
     this.SignedAccessPermission = SASPermission.None;
     this.SignedProtocol         = SasProtocol.All;
 }
コード例 #6
0
 public SignedAccessAccountIdentifier(IStorageAccount account, SecretKeyPermissions keyPermission) : base(account, keyPermission)
 {
     this.SignedAccessRestrictions = new List <SASAccessRestriction>();
     this.SignedProtocol           = SasProtocol.All;
 }
コード例 #7
0
 public TableSignedAccessAccountIdentifier(IStorageAccount account, string tableName, string startingPartitionKey, string startingRowKey, string endingPartitionKey, string endingRowKey, SecretKeyPermissions keyPermissions) : base(account, keyPermissions)
 {
     this.TableName            = tableName;
     this.StartingPartitionKey = startingPartitionKey;
     this.StartingRowKey       = startingRowKey;
     this.EndingPartitionKey   = endingPartitionKey;
     this.EndingRowKey         = endingRowKey;
 }
コード例 #8
0
 public SecretKeyV3(string keyName, byte[] keyValue, SecretKeyPermissions keyPermissions)
 {
     this.Name        = keyName;
     this.Value       = keyValue;
     this.Permissions = keyPermissions;
 }
コード例 #9
0
 protected AccountAccessRulesIdentifier(string accountName, bool accountIsAdmin, AccountPermissions accountPermissions, SecretKeyPermissions keyPermissions, bool isAnonymous) : base(accountName, accountIsAdmin, accountPermissions, keyPermissions, isAnonymous)
 {
 }
コード例 #10
0
        private IEnumerator <IAsyncResult> AuthenticateImpl(IStorageAccount storageAccount, RequestContext requestContext, NephosUriComponents uriComponents, AuthenticationManager.GetStringToSignCallback getStringToSignCallback, TimeSpan timeout, AsyncIteratorContext <IAuthenticationResult> context)
        {
            SupportedAuthScheme?nullable;
            IStorageAccount     operationStatus;

            context.ResultData = null;
            if (getStringToSignCallback == null)
            {
                throw new ArgumentNullException("getStringToSignCallback");
            }
            string str  = null;
            string str1 = null;
            bool   flag = false;

            NephosAuthenticationManager.ParseSignatureParametersFromAuthorizationHeader(requestContext, uriComponents, false, out str, out str1, out nullable, out flag);
            if (!flag)
            {
                NephosAssertionException.Assert(nullable.HasValue, "Request Authentication Scheme should have a value");
                IAccountIdentifier        accountIdentifier = null;
                AuthenticationInformation authInfoForScheme = null;
                if (this.storageManager != null)
                {
                    if (storageAccount == null || !storageAccount.Name.Equals(str))
                    {
                        try
                        {
                            operationStatus = this.storageManager.CreateAccountInstance(str);
                            if (requestContext != null)
                            {
                                operationStatus.OperationStatus = requestContext.OperationStatus;
                            }
                        }
                        catch (ArgumentOutOfRangeException argumentOutOfRangeException)
                        {
                            throw new AuthenticationFailureException(string.Format(CultureInfo.InvariantCulture, "The account name is invalid.", new object[0]));
                        }
                        operationStatus.Timeout = timeout;
                        IAsyncResult asyncResult = operationStatus.BeginGetProperties(AccountPropertyNames.All, null, context.GetResumeCallback(), context.GetResumeState("NephosAuthenticationManager.AuthenticateImpl"));
                        yield return(asyncResult);

                        try
                        {
                            operationStatus.EndGetProperties(asyncResult);
                        }
                        catch (AccountNotFoundException accountNotFoundException1)
                        {
                            AccountNotFoundException accountNotFoundException = accountNotFoundException1;
                            CultureInfo invariantCulture = CultureInfo.InvariantCulture;
                            object[]    objArray         = new object[] { str };
                            throw new AuthenticationFailureException(string.Format(invariantCulture, "Cannot find the claimed account when trying to GetProperties for the account {0}.", objArray), accountNotFoundException);
                        }
                        catch (Exception exception1)
                        {
                            Exception exception            = exception1;
                            IStringDataEventStream warning = Logger <IRestProtocolHeadLogger> .Instance.Warning;
                            warning.Log("Rethrow exception when trying to GetProperties for the account {0}: {1}", new object[] { str, exception });
                            throw;
                        }
                    }
                    else
                    {
                        operationStatus = storageAccount;
                        if (requestContext != null)
                        {
                            operationStatus.OperationStatus = requestContext.OperationStatus;
                        }
                    }
                    authInfoForScheme = NephosAuthenticationManager.GetAuthInfoForScheme(operationStatus, nullable.Value, requestContext, uriComponents, false);
                    if (authInfoForScheme == null)
                    {
                        if (storageAccount != operationStatus)
                        {
                            operationStatus.Dispose();
                        }
                        CultureInfo cultureInfo = CultureInfo.InvariantCulture;
                        object[]    name        = new object[] { nullable, operationStatus.Name };
                        throw new AuthenticationFailureException(string.Format(cultureInfo, "Authentication scheme {0} is not supported by account {1}.", name));
                    }
                    SecretKeyPermissions permissions = SecretKeyPermissions.Full;
                    if (authInfoForScheme.NamedKeyAuthData != null)
                    {
                        permissions = authInfoForScheme.NamedKeyAuthData.Permissions;
                    }
                    accountIdentifier = new AccountIdentifier(operationStatus, permissions);
                    if (storageAccount != operationStatus)
                    {
                        operationStatus.Dispose();
                    }
                }
                string str2 = null;
                try
                {
                    str2 = getStringToSignCallback(requestContext, uriComponents, nullable.Value);
                }
                catch (NotSupportedException notSupportedException)
                {
                    CultureInfo invariantCulture1 = CultureInfo.InvariantCulture;
                    object[]    objArray1         = new object[] { nullable };
                    throw new AuthenticationFailureException(string.Format(invariantCulture1, "Authentication scheme {0} is not supported.", objArray1));
                }
                AuthenticationMethod item = NephosAuthenticationManager.serviceAuthMethodsTable[requestContext.ServiceType][nullable.Value];
                item(str2, str1, authInfoForScheme);
                NephosAssertionException.Assert(accountIdentifier != null);
                context.ResultData = new AuthenticationResult(accountIdentifier, null, false);
            }
            else
            {
                context.ResultData = new AuthenticationResult(AuthenticationManager.AnonymousAccount, null, false);
            }
        }