Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProviderFactory"/>
        /// </summary>
        /// <param name="factoryName"><para>A friendly name that will be included in exception messages.</para></param>
        /// <param name="configurationContext"><para>The <see cref="ConfigurationContext"/> to use.</para></param>
        /// <param name="type"><para>The base type of all providers that this factory will create.</para></param>
        /// <excpetion cref="ArgumentNullException">
        /// <para><paramref name="configurationContext"/> is a <see langword="null"/> reference (Nothing in Visual Basic).</para>
        /// <para>- or -</para>
        /// <para><paramref name="factoryName"/> is a <see langword="null"/> reference (Nothing in Visual Basic).</para>
        /// <para>- or -</para>
        /// <para><paramref name="type"/> is a <see langword="null"/> reference (Nothing in Visual Basic).</para>
        /// </excpetion>
        protected ProviderFactory(string factoryName, ConfigurationContext configurationContext, Type type)
            : base(factoryName, configurationContext)
        {
            ArgumentValidation.CheckForNullReference(type, "type");

            this.type = type;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Instantiates a new instance of the 
 /// <see cref="ExceptionPolicyEntry"/> class.
 /// </summary>
 internal ExceptionPolicyEntry(string policyName, ExceptionTypeData typeData, ConfigurationContext context)
 {
     this.policyName = policyName;
     this.postHandlingAction = typeData.PostHandlingAction;
     this.typeDataName = typeData.Name;
     this.factory = new ExceptionHandlerFactory(context);
 }
Ejemplo n.º 3
0
 public UserForm(DbAuthenticationProviderData dbAuthenticationProvider, ConfigurationContext context, string username)
     : this(dbAuthenticationProvider, context)
 {
     tbxUser.Text = username;
     tbxUser.Enabled = false;
     editMode = true;
     label3.Text = SR.NewPasswordLabel;
 }
Ejemplo n.º 4
0
 public RoleForm(DbAuthenticationProviderData dbAuthenticationProviderData, ConfigurationContext context, string role)
     : this(dbAuthenticationProviderData, context)
 {
     tbxRole.Text = role;
     originalRoleName = role;
     editMode = true;
     UpdateSaveButtonEnabled();
 }
Ejemplo n.º 5
0
        public RoleForm(DbAuthenticationProviderData dbAuthenticationProviderData, ConfigurationContext context)
        {
            this.dbAuthenticationproviderData = dbAuthenticationProviderData;
            InitializeComponent();

            this.userRoleMgr = new UserRoleManager(dbAuthenticationProviderData.Database, context);

            UpdateSaveButtonEnabled();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// <para>Initializes a new instance of the <see cref="ConfigurationFactory"/> class with the factory name and a <see cref="ConfigurationContext"/>.</para>
        /// </summary>
        /// <param name="factoryName">
        /// <para>The name of the factory.</para>
        /// </param>
        /// <param name="configurationContext">
        /// <para>A <see cref="ConfigurationContext"/> object</para>
        /// </param>
        protected ConfigurationFactory(string factoryName, ConfigurationContext configurationContext)
        {
            ArgumentValidation.CheckForNullReference(configurationContext, "configurationContext");
            ArgumentValidation.CheckForNullReference(factoryName, "providerName");
            ArgumentValidation.CheckForEmptyString(factoryName, "factoryName");

            this.configurationContext = configurationContext;
            this.factoryName = factoryName;
        }
Ejemplo n.º 7
0
        public UserForm(DbAuthenticationProviderData dbAuthenticationProvider, ConfigurationContext context)
        {
            this.dbAuthenticationProvider = dbAuthenticationProvider;
            InitializeComponent();

            this.userRoleMgr = new UserRoleManager(dbAuthenticationProvider.Database, context);

            HashProviderFactory hashProviderFactory = new HashProviderFactory(context);
            this.hashProvider = hashProviderFactory.CreateHashProvider(dbAuthenticationProvider.HashProvider);
            UpdateSaveButtonEnabled();
        }
Ejemplo n.º 8
0
        public MainForm(ConfigurationContext configurationContext)
        {
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            this.configurationContext = configurationContext;

            InitializeComponent();

            UpdateEditRoleButtonEnabled();
            UpdateEditUserButtonEnabled();
            UpdateConnectButtonEnabled();
            UpdateUserToRoleButtonsEnabled();
        }
Ejemplo n.º 9
0
        public static void CreateTestData(ConfigurationContext context)
        {
            UserRoleManager urm = new UserRoleManager("EntLibSecurity", context);

            DeleteTestData(context);

            byte[] pwd = SHA1Managed.Create().ComputeHash(ASCIIEncoding.ASCII.GetBytes("Password"));
            byte [] emptyPasswd = SHA1Managed.Create().ComputeHash(ASCIIEncoding.ASCII.GetBytes(""));

            urm.CreateUser("testuser", pwd);
            urm.CreateUser("bogususer", pwd);
            urm.CreateUser("emptyUser", emptyPasswd);

            urm.CreateRole("Admins");
            urm.CreateRole("Managers");
            urm.CreateRole("Users");

            urm.CreateUserRole("testuser", "Users");
            urm.CreateUserRole("testuser", "Managers");
        }
Ejemplo n.º 10
0
 public StorageProviderFactory(ConfigurationContext context) : base(SR.StorageProvider, context, typeof(IStorageProviderReader))
 {
 }
Ejemplo n.º 11
0
 /// <summary>
 /// <para>Initialize a new instance of the <see cref="CachingConfigurationView"/> with a <see cref="ConfigurationContext"/>.</para>
 /// </summary>
 /// <param name="configurationContext">
 /// <para>A <see cref="ConfigurationContext"/> object.</para>
 /// </param>
 public CachingConfigurationView(ConfigurationContext configurationContext)
     : base(configurationContext)
 {
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of <see cref="LogDistributor"></see>
 /// </summary>
 /// <param name="configurationContext"><see cref="ConfigurationContext"></see> used to initialize this instance</param>
 public LogDistributor(ConfigurationContext configurationContext)
 {
     this.loggingConfigurationView = new LoggingConfigurationView(configurationContext);
     this.events = new DistributorEvents();
     this.defaulLogSink = new DefaultLogDestination();
 }
 public void Initialize(ProviderData providerData, ConfigurationContext configurationContext)
 {
 }
 /// <summary>
 /// <para>Initialize a new instance of the <see cref="CryptographyConfigurationView"/> class with a <see cref="ConfigurationContext"/> object.</para>
 /// </summary>
 /// <param name="configurationContext">
 /// <para>A <see cref="ConfigurationContext"/> object.</para>
 /// </param>
 public CryptographyConfigurationView(ConfigurationContext configurationContext)
     : base(configurationContext)
 {
 }
Ejemplo n.º 15
0
        /// <summary>
        /// <para>Initialize a new instance of the <see cref="ConfigurationView"/> with a <see cref="ConfigurationContext"/>.</para>
        /// </summary>
        /// <param name="context">
        /// <para>A <see cref="ConfigurationContext"/> object.</para>
        /// </param>
        protected ConfigurationView(ConfigurationContext context)
        {
            ArgumentValidation.CheckForNullReference(context, "context");

            this.context = context;
        }
Ejemplo n.º 16
0
 public TransformerFactory(ConfigurationContext context) : base(SR.Transformer, context, typeof(ITransformer))
 {
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Set up the queue with the specified logger
 /// </summary>
 /// <param name="configurationContext"><see cref="ConfigurationContext"></see> containing current configuration information</param>
 /// <param name="eventLogger"><see cref="DistributorEventLogger"></see> to use for distributing events from this object</param>
 public MsmqLogDistributor(ConfigurationContext configurationContext, DistributorEventLogger eventLogger)
     : base(configurationContext)
 {
     this.eventLogger = eventLogger;
 }
Ejemplo n.º 18
0
 /// <summary>
 /// <para>
 /// Initializes a new instance of the <see cref="ExceptionHandlerFactory"/> class with the specified <see cref="ConfigurationContext"/>.
 /// </para>
 /// </summary>
 /// <param name="configurationContext">
 /// <para>Configuration context to use when creating factory</para>
 /// </param>
 public ExceptionHandlerFactory(ConfigurationContext configurationContext)
     : base(SR.HandlerFactoryName, configurationContext, typeof(IExceptionHandler))
 {
     this.policyName = string.Empty;
     this.exceptionTypeName = string.Empty;
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LogSinkFactory"/> class.
 /// </summary>
 public LogSinkFactory(ConfigurationContext context)
     : base(SR.SinkFactoryName, context, typeof(ILogSink))
 {
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Returns the named IRolesProvider instance. Guaranteed to return an initialized IRolesProvider if no exception thrown.
 /// </summary>
 /// <param name="rolesProviderName">Name defined in configuration for the Roles provider to instantiate</param>
 /// <param name="context">The configuration context to use.</param>
 /// <returns>Named Roles provider instance</returns>
 /// <exception cref="ArgumentNullException">providerName is null</exception>
 /// <exception cref="ArgumentException">providerName is empty</exception>
 /// <exception cref="ConfigurationException">Could not find instance specified in providerName</exception>
 /// <exception cref="InvalidOperationException">Error processing configuration information defined in application configuration file.</exception>
 public static IRolesProvider GetRolesProvider(string rolesProviderName, ConfigurationContext context)
 {
     RolesProviderFactory factory = new RolesProviderFactory(context);
     return factory.GetRolesProvider(rolesProviderName);
 }
 public TestLoggingConfigurationView(ConfigurationContext context)
     : base(context)
 {
 }
Ejemplo n.º 22
0
 /// <summary>
 /// <para>Initialize a new instance of the <see cref="SecurityConfigurationView"/> class with a <see cref="ConfigurationContext"/> object.</para>
 /// </summary>
 /// <param name="configurationContext">
 /// <para>A <see cref="ConfigurationContext"/> object.</para>
 /// </param>
 public SecurityConfigurationView(ConfigurationContext configurationContext)
     : base(configurationContext)
 {
 }
Ejemplo n.º 23
0
        internal static byte[] CreateHash(string hashInstance, byte[] plaintext, ConfigurationContext context)
        {
            ArgumentValidation.CheckForNullReference(hashInstance, "hashInstance");
            ArgumentValidation.CheckForEmptyString(hashInstance, "hashInstance");

            HashProviderFactory factory = new HashProviderFactory(context);
            IHashProvider hashProvider = factory.CreateHashProvider(hashInstance);
            return hashProvider.CreateHash(plaintext);
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Creates an instance of the factory.
 /// </summary>
 /// <param name="context">The current configuration context.</param>
 public SecurityCacheProviderFactory(ConfigurationContext context)
     : base(SR.SecurityCache, context, typeof(ISecurityCacheProvider))
 {
 }
Ejemplo n.º 25
0
        internal static string CreateHash(string hashInstance, string plaintext, ConfigurationContext context)
        {
            ArgumentValidation.CheckForNullReference(hashInstance, "hashInstance");
            ArgumentValidation.CheckForEmptyString(hashInstance, "hashInstance");

            byte[] plainTextBytes = UnicodeEncoding.Unicode.GetBytes(plaintext);
            byte[] resultBytes = CreateHash(hashInstance, plainTextBytes, context);
            CryptographyUtility.GetRandomBytes(plainTextBytes);

            return Convert.ToBase64String(resultBytes);
        }
 public TestAuthorizationRuleProviderView(AuthorizationRuleProviderData data, ConfigurationContext context)
     : base(context)
 {
     this.data = data;
 }
Ejemplo n.º 27
0
        internal static string DecryptSymmetric(string symmetricInstance, string ciphertextBase64, ConfigurationContext context)
        {
            ArgumentValidation.CheckForNullReference(symmetricInstance, "symmetricInstance");
            ArgumentValidation.CheckForEmptyString(symmetricInstance, "symmetricInstance");

            byte[] cipherTextBytes = Convert.FromBase64String(ciphertextBase64);
            byte[] decryptedBytes = DecryptSymmetric(symmetricInstance, cipherTextBytes, context);
            string decryptedString = UnicodeEncoding.Unicode.GetString(decryptedBytes);
            CryptographyUtility.GetRandomBytes(decryptedBytes);

            return decryptedString;
        }
 public MockAuthenticationProvider(ProviderData providerData, ConfigurationContext context)
 {
 }
Ejemplo n.º 29
0
        internal static byte[] EncryptSymmetric(string symmetricInstance, byte[] plaintext, ConfigurationContext context)
        {
            ArgumentValidation.CheckForNullReference(symmetricInstance, "symmetricInstance");
            ArgumentValidation.CheckForEmptyString(symmetricInstance, "symmetricInstance");

            SymmetricCryptoProviderFactory factory = new SymmetricCryptoProviderFactory(context);
            ISymmetricCryptoProvider symmetricProvider = factory.CreateSymmetricCryptoProvider(symmetricInstance);
            return symmetricProvider.Encrypt(plaintext);
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthorizationProviderFactory"/>
 /// with the specified <see cref="ConfigurationContext"/>.
 /// </summary>
 /// <param name="context">A <see cref="ConfigurationContext"/>.</param>
 public AuthorizationProviderFactory(ConfigurationContext context)
     : base(SR.Authorization, context, typeof(IAuthorizationProvider))
 {
 }
Ejemplo n.º 31
0
        internal static string EncryptSymmetric(string symmetricInstance, string plaintext, ConfigurationContext context)
        {
            ArgumentValidation.CheckForNullReference(symmetricInstance, "symmetricInstance");
            ArgumentValidation.CheckForEmptyString(symmetricInstance, "symmetricInstance");

            byte[] plainTextBytes = UnicodeEncoding.Unicode.GetBytes(plaintext);
            byte[] cipherTextBytes = EncryptSymmetric(symmetricInstance, plainTextBytes, context);
            CryptographyUtility.GetRandomBytes(plainTextBytes);
            return Convert.ToBase64String(cipherTextBytes);
        }
 /// <summary>
 /// <para>Initialize a new instance of the <see cref="SymmetricCryptoProviderFactory"/> class with a <see cref="ConfigurationContext"/> object.</para>
 /// </summary>
 /// <param name="context">A <see cref="ConfigurationContext"/> object.</param>
 public SymmetricCryptoProviderFactory(ConfigurationContext context)
     : base(SR.SymmetricCryptoFactory, context, typeof(ISymmetricCryptoProvider))
 {
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Setup the queue and the formatter of the messages.
 /// </summary>
 public MsmqLogDistributor(ConfigurationContext configurationContext)
     : this(configurationContext, new DistributorEventLogger())
 {
 }