예제 #1
0
        /// <exception cref="System.Exception"/>
        private void CheckTranslation(string from, string to)
        {
            System.Console.Out.WriteLine("Translate " + from);
            KerberosName nm     = new KerberosName(from);
            string       simple = nm.GetShortName();

            System.Console.Out.WriteLine("to " + simple);
            Assert.Equal("short name incorrect", to, simple);
        }
예제 #2
0
        public virtual void SetUp()
        {
            Runtime.SetProperty("java.security.krb5.realm", KerberosTestUtils.GetRealm());
            Runtime.SetProperty("java.security.krb5.kdc", "localhost:88");
            string rules = "RULE:[1:$1@$0](.*@YAHOO\\.COM)s/@.*//\n" + "RULE:[2:$1](johndoe)s/^.*$/guest/\n"
                           + "RULE:[2:$1;$2](^.*;admin$)s/;admin$//\n" + "RULE:[2:$2](root)\n" + "DEFAULT";

            KerberosName.SetRules(rules);
            KerberosName.PrintRules();
        }
예제 #3
0
        public virtual void TestToLowerCase()
        {
            string rules = "RULE:[1:$1]/L\n" + "RULE:[2:$1]/L\n" + "RULE:[2:$1;$2](^.*;admin$)s/;admin$///L\n"
                           + "RULE:[2:$1;$2](^.*;guest$)s/;guest$//g/L\n" + "DEFAULT";

            KerberosName.SetRules(rules);
            KerberosName.PrintRules();
            CheckTranslation("*****@*****.**", "joe");
            CheckTranslation("Joe/[email protected]", "joe");
            CheckTranslation("Joe/[email protected]", "joe");
            CheckTranslation("Joe/[email protected]", "joe");
        }
예제 #4
0
        // PASS
        private void CheckBadTranslation(string from)
        {
            System.Console.Out.WriteLine("Checking bad translation for " + from);
            KerberosName nm = new KerberosName(from);

            try
            {
                nm.GetShortName();
                NUnit.Framework.Assert.Fail("didn't get exception for " + from);
            }
            catch (IOException)
            {
            }
        }