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()); 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); } }
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); }