public static OpenIdNotify CreateInstance(string name, NameValueCollection parameters) { OpenIdNotify result; if (string.IsNullOrEmpty(name)) { result = null; } else { object[] args = new object[] { parameters }; OpenIdPlugins openIdPlugins = OpenIdPlugins.Instance(); Type plugin = openIdPlugins.GetPlugin("OpenIdService", name); if (plugin == null) { result = null; } else { Type pluginWithNamespace = openIdPlugins.GetPluginWithNamespace("OpenIdNotify", plugin.Namespace); if (pluginWithNamespace == null) { result = null; } else { result = (Activator.CreateInstance(pluginWithNamespace, args) as OpenIdNotify); } } } return(result); }
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); }
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()); } else { 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>"); } else { context.Response.Write(openIdService.GetMetaData().OuterXml); } } } }
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); }