Ejemplo n.º 1
0
        private static AuthData GetConfig()
        {
            AuthData conf;

            AuthSection auth = ConfigurationManager.GetSection("authSection") as AuthSection;

            if (auth == null || String.IsNullOrEmpty(auth.UserName) || String.IsNullOrEmpty(auth.Password))
            {
#if DEBUG
                // Try the user auth.config file in the sandbox root (this tool is obviously incorrect if not running near the source code)
                if (File.Exists(ConfigurationManager.AppSettings["AlternativeAuthConf"]))
                {
                    conf = AuthData.Load(ConfigurationManager.AppSettings["AlternativeAuthConf"]);
                }
                else
#endif
                {
                    throw new AuthorizationException("Invalid authSection in configuration file", null);
                }
            }
            else
            {
                conf = new AuthData
                {
                    Username = auth.UserName,
                    Password = auth.Password
                };
            }

            return(conf);
        }
Ejemplo n.º 2
0
        public override void OnSetup()
        {
            // This unit test relies on the user configuration
            AuthData d = AuthData.Load("..\\..\\..\\auth.config");

            if (d != null)
            {
                Username = d.Username;
                Password = d.Password;
            }
        }