public bool AuthenticateAnonymousUser(string user_id, string user_token) { TableOperation retrieveOperation = TableOperation.Retrieve <DynamicTableEntity>(user_id, user_token); try { DynamicTableEntity user_entity = (DynamicTableEntity)this.UsersTable.Execute (retrieveOperation).Result; if (user_entity == null) { return(false); } else { IStorageUser user = this.UserEntityResolver(user_entity.PartitionKey, user_entity.RowKey, user_entity.Timestamp, user_entity.Properties, user_entity.ETag); OverlordIdentity.InitializeUserIdentity(user.Id.ToUrn(), user.Token, user.Devices.Select(d => d.ToUrn()).ToList <String>()); return(true); } } catch (Exception e) { Log.ReadTableFailure(string.Format("Failed to read user entity: Id: {0}, Token: {1}.", user_id, user_token), e); throw; } finally { } /* * TableOperation retrieveOperation = TableOperation.Retrieve<DynamicTableEntity>(urn_id, token); * TableQuery<DynamicTableEntity> query = new TableQuery<DynamicTableEntity>().Where( * TableQuery.CombineFilters( * TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, urn_id.UrnToId()), * TableOperators.And, * TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, token) * ) * ); * IEnumerable<IStorageUser> user = this.UsersTable.ExecuteQuery<DynamicTableEntity, IStorageUser>(query, this.UserEntityResolverFunc); * return user.FirstOrDefault(); */ //return null; }
public static void ReadTableFailure(this AzureStorageEventSource ev, string message, Exception e) { ev.ReadTableFailure(message, e.ToString()); }