public override string[] GetRolesForUser(string username)
		{
            FoireMusesConnection connection = new FoireMusesConnection(new XUri(Configuration.ApiUrl + ":" + Configuration.ApiPort + "/" + Configuration.ApiAt), Configuration.ApiUsername, Configuration.ApiPassword);
			try
			{
				User user = connection.GetUser(username, new Result<User>()).Wait();
				if (user.IsAdmin)
					return new string[] { "ADMIN", "MEMBER" };
				else
					return new string[] { "MEMBER" };
			}
			catch (Exception e)
			{
				return new string[] { };
			}
		}
		public override bool ValidateUser(string username, string password)
		{
			FoireMusesConnection connection = new FoireMusesConnection(new XUri(Configuration.ApiUrl + ":" + Configuration.ApiPort + "/" + Configuration.ApiAt), Configuration.ApiUsername, Configuration.ApiPassword);
			try
			{
				User user = connection.GetUser(username, new Result<User>()).Wait();
				if (user == null)
					return false;
				if (user.Password != password)
					return false;
				return true;
			}
			catch (Exception e)
			{
				return false;
			}
		}
		public override bool IsUserInRole(string username, string roleName)
		{
			if (roleName == "MEMBER")
				return true;
            FoireMusesConnection connection = new FoireMusesConnection(new XUri(Configuration.ApiUrl + ":" + Configuration.ApiPort + "/" + Configuration.ApiAt), Configuration.ApiUsername, Configuration.ApiPassword);
			try
			{
				User user = connection.GetUser(username, new Result<User>()).Wait();
				if (user.IsAdmin)
					return true;
				return false;
			}
			catch (Exception e)
			{
				return false;
			}
		}
		protected FoireMusesConnection GetConnection()
		{

			FoireMusesConnection connection = new FoireMusesConnection(new XUri(Configuration.ApiUrl+":"+Configuration.ApiPort+"/"+Configuration.ApiAt), Configuration.ApiUsername, Configuration.ApiPassword);

			if (!User.Identity.IsAuthenticated)
			{
				return connection;
			}
			else
			{
				// Enables the remote process to use the user's credentials instead of this process' credentials
				//use settings to create default creditentials to be used by the server.
				//use some secret key
				connection.Impersonate(User.Identity.Name);
				return connection;
			}
		}