public static OAuth2Provider Create(OAuth2ProviderOptions options, string name) { try { Type type = Type.GetType(string.Concat("Cnaws.Passport.OAuth2.Providers.", name, ",Cnaws.Passport"), true, true); object result = Activator.CreateInstance(type, new object[] { options }); if (TType <OAuth2Provider> .Type.IsAssignableFrom(result.GetType())) { return((OAuth2Provider)result); } } catch (Exception) { } return(null); }
protected OAuth2Provider(OAuth2ProviderOptions options) { if (options == null) { throw new ArgumentNullException("options"); } if (string.IsNullOrEmpty(options.ClientId)) { throw new ArgumentException("Required option not provided: ClientId"); } _options = options; _parameters = new SortedDictionary <string, object>(); if (options.Scope.Count > 0) { _scope = options.Scope; } else { _scope = new List <string>(); } _redirectUri = HttpContext.Current.Request.Url.ToString(); }