private IUserIdentityProvider GetProvider()
        {
            IUserIdentityProvider retVal = null;
            App app = Configuration.GetInstance().App;

            string assemblyName = app.UserIdentityProviderAssembly;
            string className    = app.UserIdentityProviderClass;
            string config       = app.UserIdentityProviderConfig;


            if (!String.IsNullOrEmpty(assemblyName) && !String.IsNullOrEmpty(className))
            {
                try
                {
                    retVal = Common.CreateInstance(assemblyName, className) as IUserIdentityProvider;
                    retVal.Initialize(config);
                }
                catch (Exception ex)
                {
                    Common.LogException(ex);
                }
            }

            if (retVal == null)
            {
                throw new Exception(String.Format("No valid identity provider was found"));
            }

            return(retVal);
        }
Exemple #2
0
        private IUserIdentityProvider GetProvider()
        {
            IUserIdentityProvider retVal = null;
            App app = Configuration.GetInstance().App;

            string assemblyName = app.UserIdentityProviderAssembly;
            string className    = app.UserIdentityProviderClass;
            string config       = app.UserIdentityProviderConfig;


            if (!String.IsNullOrEmpty(assemblyName) && !String.IsNullOrEmpty(className))
            {
                try
                {
                    Assembly providerAssembly = Assembly.Load(assemblyName);
                    if (providerAssembly != null)
                    {
                        Type type = providerAssembly.GetType(className, true, true);

                        if (type != null)
                        {
                            ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes);
                            retVal = constructor.Invoke(null) as IUserIdentityProvider;

                            retVal.Initialize(config);
                        }
                    }
                }
                catch
                {
                    //silent error
                }
            }

            if (retVal == null)
            {
                throw new Exception(String.Format("No valid identity provider was found"));
            }

            return(retVal);
        }