Пример #1
0
        public static OpenIdNotify CreateInstance(string name, NameValueCollection parameters)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            object[] args = new object[1]
            {
                parameters
            };
            OpenIdPlugins openIdPlugins = OpenIdPlugins.Instance();
            Type          plugin        = openIdPlugins.GetPlugin("OpenIdService", name);

            if (plugin == null)
            {
                return(null);
            }
            Type pluginWithNamespace = openIdPlugins.GetPluginWithNamespace("OpenIdNotify", plugin.Namespace);

            if (pluginWithNamespace == null)
            {
                return(null);
            }
            return(Activator.CreateInstance(pluginWithNamespace, args) as OpenIdNotify);
        }
Пример #2
0
        public static OpenIdService CreateInstance(string name, string configXml, string returnUrl)
        {
            OpenIdService result;

            if (string.IsNullOrEmpty(name))
            {
                result = null;
            }
            else
            {
                object[] args = new object[]
                {
                    returnUrl
                };
                Type plugin = OpenIdPlugins.Instance().GetPlugin("OpenIdService", name);
                if (plugin == null)
                {
                    result = null;
                }
                else
                {
                    OpenIdService openIdService = Activator.CreateInstance(plugin, args) as OpenIdService;
                    if (openIdService != null && !string.IsNullOrEmpty(configXml))
                    {
                        XmlDocument xmlDocument = new XmlDocument();
                        xmlDocument.LoadXml(configXml);
                        openIdService.InitConfig(xmlDocument.FirstChild);
                    }
                    result = openIdService;
                }
            }
            return(result);
        }
        public static OpenIdService CreateInstance(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            Type plugin = OpenIdPlugins.Instance().GetPlugin("OpenIdService", name);

            if (plugin == null)
            {
                return(null);
            }
            return(Activator.CreateInstance(plugin) as OpenIdService);
        }
Пример #4
0
 public static OpenIdPlugins Instance()
 {
     if (instance == null)
     {
         lock (LockHelper)
         {
             if (instance == null)
             {
                 instance = new OpenIdPlugins();
             }
         }
     }
     instance.VerifyIndex();
     return instance;
 }
Пример #5
0
 public static OpenIdPlugins Instance()
 {
     if (OpenIdPlugins.instance == null)
     {
         lock (OpenIdPlugins.LockHelper)
         {
             if (OpenIdPlugins.instance == null)
             {
                 OpenIdPlugins.instance = new OpenIdPlugins();
             }
         }
     }
     OpenIdPlugins.instance.VerifyIndex();
     return(OpenIdPlugins.instance);
 }
Пример #6
0
 private void ProcessOpenId(HttpContext context)
 {
     if (context.Request["action"] == "getlist")
     {
         OpenIdPlugins openIdPlugins = OpenIdPlugins.Instance();
         context.Response.ContentType = "application/json";
         context.Response.Write(openIdPlugins.GetPlugins().ToJsonString());
         return;
     }
     if (context.Request["action"] == "getmetadata")
     {
         context.Response.ContentType = "text/xml";
         OpenIdService openIdService = OpenIdService.CreateInstance(context.Request["name"]);
         if (openIdService == null)
         {
             context.Response.Write("<xml></xml>");
             return;
         }
         context.Response.Write(openIdService.GetMetaData().OuterXml);
     }
 }
Пример #7
0
 public static OpenIdPlugins Instance()
 {
     if (OpenIdPlugins.instance == null)
     {
         object lockHelper;
         Monitor.Enter(lockHelper = OpenIdPlugins.LockHelper);
         try
         {
             if (OpenIdPlugins.instance == null)
             {
                 OpenIdPlugins.instance = new OpenIdPlugins();
             }
         }
         finally
         {
             Monitor.Exit(lockHelper);
         }
     }
     OpenIdPlugins.instance.VerifyIndex();
     return(OpenIdPlugins.instance);
 }
Пример #8
0
        public static OpenIdService CreateInstance(string name)
        {
            OpenIdService result;

            if (string.IsNullOrEmpty(name))
            {
                result = null;
            }
            else
            {
                Type plugin = OpenIdPlugins.Instance().GetPlugin("OpenIdService", name);
                if (plugin == null)
                {
                    result = null;
                }
                else
                {
                    result = (Activator.CreateInstance(plugin) as OpenIdService);
                }
            }
            return(result);
        }
        public static OpenIdService CreateInstance(string name, string configXml, string returnUrl)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            object[] args   = new object[] { returnUrl };
            Type     plugin = OpenIdPlugins.Instance().GetPlugin("OpenIdService", name);

            if (plugin == null)
            {
                return(null);
            }
            OpenIdService service = Activator.CreateInstance(plugin, args) as OpenIdService;

            if ((service != null) && !string.IsNullOrEmpty(configXml))
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml(configXml);
                service.InitConfig(document.FirstChild);
            }
            return(service);
        }