Esempio n. 1
0
        public void CreateAuthenticatorUserName()
        {
            SecurityTokenRequirement r =
                new RecipientServiceModelSecurityTokenRequirement();

            r.TokenType = SecurityTokenTypes.UserName;
            SecurityTokenResolver resolver;

            SecurityTokenAuthenticator a =
                def_c.CreateSecurityTokenAuthenticator(r, out resolver);

            Assert.AreEqual(typeof(WindowsUserNameSecurityTokenAuthenticator), a.GetType(), "#1");
            Assert.IsNull(resolver, "#2");

            def_c.ServiceCredentials.UserNameAuthentication.UserNamePasswordValidationMode  = UserNamePasswordValidationMode.Custom;
            def_c.ServiceCredentials.UserNameAuthentication.CustomUserNamePasswordValidator = new MyUserNameValidator();
            a = def_c.CreateSecurityTokenAuthenticator(r, out resolver);
            Assert.AreEqual(typeof(CustomUserNameSecurityTokenAuthenticator), a.GetType(), "#3");
            Assert.IsNull(resolver, "#4");
        }