public async Task <bool> UserExists(string id) { var partitionKey = BackOfficeUserEntity.GeneratePartitionKey(); var rowKey = BackOfficeUserEntity.GenerateRowKey(id); return((await _tableStorage.GetDataAsync(partitionKey, rowKey)) != null); }
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; })); }
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)); }
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); }