示例#1
0
//        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        public static IServiceAuth Create(IConfigSource config, string section)
        {
            CompoundAuthentication compoundAuth = new CompoundAuthentication();

            bool allowLlHttpRequestIn
                = Util.GetConfigVarFromSections <bool>(config, "AllowllHTTPRequestIn", new string[] { "Network", section }, false);

            if (!allowLlHttpRequestIn)
            {
                compoundAuth.AddAuthenticator(new DisallowLlHttpRequest());
            }

            string authType = Util.GetConfigVarFromSections <string>(config, "AuthType", new string[] { "Network", section }, "None");

            switch (authType)
            {
            case "BasicHttpAuthentication":
                compoundAuth.AddAuthenticator(new BasicHttpAuthentication(config, section));
                break;
            }

//            foreach (IServiceAuth auth in compoundAuth.GetAuthentors())
//                m_log.DebugFormat("[SERVICE AUTH]: Configured authenticator {0}", auth.Name);

            if (compoundAuth.Count > 0)
            {
                return(compoundAuth);
            }
            else
            {
                return(null);
            }
        }
示例#2
0
//        private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

        public static IServiceAuth Create(IConfigSource config, string section)
        {
            CompoundAuthentication compoundAuth = new CompoundAuthentication();

            bool allowLlHttpRequestIn
                = Util.GetConfigVarFromSections<bool>(config, "AllowllHTTPRequestIn", new string[] { "Network", section }, false);

            if (!allowLlHttpRequestIn)
                compoundAuth.AddAuthenticator(new DisallowLlHttpRequest());

            string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None");

            switch (authType)
            {
                case "BasicHttpAuthentication":
                    compoundAuth.AddAuthenticator(new BasicHttpAuthentication(config, section));
                    break;
            }

//            foreach (IServiceAuth auth in compoundAuth.GetAuthentors())
//                m_log.DebugFormat("[SERVICE AUTH]: Configured authenticator {0}", auth.Name);

            if (compoundAuth.Count > 0)
                return compoundAuth;
            else
                return null;
        }
示例#3
0
        public static IServiceAuth Create(IConfigSource config, string section)
        {
            CompoundAuthentication compoundAuth = new CompoundAuthentication();

            bool allowLlHttpRequestIn
                = Util.GetConfigVarFromSections <bool>(config, "AllowllHTTPRequestIn", new string[] { "Network", section }, false);

            if (!allowLlHttpRequestIn)
            {
                compoundAuth.AddAuthenticator(new DisallowLlHttpRequest());
            }

            string authType = Util.GetConfigVarFromSections <string>(config, "AuthType", new string[] { "Network", section }, "None");

            switch (authType)
            {
            case "BasicHttpAuthentication":
                compoundAuth.AddAuthenticator(new BasicHttpAuthentication(config, section));
                break;
            }

            if (compoundAuth.Count > 0)
            {
                return(compoundAuth);
            }
            else
            {
                return(null);
            }
        }
示例#4
0
        public static IServiceAuth Create(IConfigSource config, string section)
        {
            CompoundAuthentication compoundAuth = new CompoundAuthentication();

            bool allowLlHttpRequestIn
                = Util.GetConfigVarFromSections<bool>(config, "AllowllHTTPRequestIn", new string[] { "Network", section }, false);

            if (!allowLlHttpRequestIn)
                compoundAuth.AddAuthenticator(new DisallowLlHttpRequest());

            string authType = Util.GetConfigVarFromSections<string>(config, "AuthType", new string[] { "Network", section }, "None");

            switch (authType)
            {
                case "BasicHttpAuthentication":
                    compoundAuth.AddAuthenticator(new BasicHttpAuthentication(config, section));
                    break;
            }

            if (compoundAuth.Count > 0)
                return compoundAuth;
            else
                return null;
        }