Пример #1
0
        public async Task <bool> UserExists(string id)
        {
            var partitionKey = BackOfficeUserEntity.GeneratePartitionKey();
            var rowKey       = BackOfficeUserEntity.GenerateRowKey(id);

            return((await _tableStorage.GetDataAsync(partitionKey, rowKey)) != null);
        }
Пример #2
0
        public Task ChangePasswordAsync(string id, string newPassword)
        {
            var partitionKey = BackOfficeUserEntity.GeneratePartitionKey();
            var rowKey       = BackOfficeUserEntity.GenerateRowKey(id);

            return(_tableStorage.ReplaceAsync(partitionKey, rowKey, itm =>
            {
                itm.SetPassword(newPassword);
                return itm;
            }));
        }
Пример #3
0
        public async Task <IBackOfficeUser> GetAsync(string id)
        {
            if (id == null)
            {
                return(null);
            }

            var partitionKey = BackOfficeUserEntity.GeneratePartitionKey();
            var rowKey       = BackOfficeUserEntity.GenerateRowKey(id);

            return(await _tableStorage.GetDataAsync(partitionKey, rowKey));
        }
Пример #4
0
        public async Task <IBackOfficeUser> AuthenticateAsync(string username, string password)
        {
            if (username == null || password == null)
            {
                return(null);
            }

            var partitionKey = BackOfficeUserEntity.GeneratePartitionKey();
            var rowKey       = BackOfficeUserEntity.GenerateRowKey(username);


            var entity = await _tableStorage.GetDataAsync(partitionKey, rowKey);

            if (entity == null)
            {
                return(null);
            }


            return(entity.CheckPassword(password) ? entity : null);
        }