@Test public void testAntiPatterns() throws Exception { checkBadName("owen/owen/owen@FOO.COM"); checkBadName("owen@foo/bar.com"); // no rules applied, these should pass checkTranslation("foo@ACME.COM", "foo@ACME.COM"); checkTranslation("root/joe@FOO.COM", "root/joe@FOO.COM"); }
@Test public void testAntiPatterns() throws Exception { checkBadName("owen/owen/owen@FOO.COM"); checkBadName("owen@foo/bar.com"); checkBadTranslation("foo@ACME.COM"); checkBadTranslation("root/joe@FOO.COM"); }
@Test public void testRules() throws Exception { checkTranslation("omalley@" + KerberosTestUtils.getRealm(), "omalley"); checkTranslation("hdfs/10.0.0.1@" + KerberosTestUtils.getRealm(), "hdfs"); checkTranslation("oom@YAHOO.COM", "oom"); checkTranslation("johndoe/zoo@FOO.COM", "guest"); checkTranslation("joe/admin@FOO.COM", "joe"); checkTranslation("joe/root@FOO.COM", "root"); }
@Test public void testRules() throws Exception { checkTranslation("omalley@" + KerberosTestUtils.getRealm(), "omalley"); checkTranslation("hdfs/10.0.0.1@" + KerberosTestUtils.getRealm(), "hdfs"); checkTranslation("oom@YAHOO.COM", "oom"); checkTranslation("johndoe/zoo@FOO.COM", "guest"); checkTranslation("joe/admin@FOO.COM", "joe"); checkTranslation("joe/root@FOO.COM", "root"); }
@Test public void testAntiPatterns() throws Exception { checkBadName("owen/owen/owen@FOO.COM"); checkBadName("owen@foo/bar.com"); // no rules applied, these should pass checkTranslation("foo@ACME.COM", "foo@ACME.COM"); checkTranslation("root/joe@FOO.COM", "root/joe@FOO.COM"); }
@Test public void testRules() throws Exception { checkTranslation("omalley@" + KerberosTestUtils.getRealm(), "omalley"); checkTranslation("hdfs/10.0.0.1@" + KerberosTestUtils.getRealm(), "hdfs"); checkTranslation("oom@YAHOO.COM", "oom"); checkTranslation("johndoe/zoo@FOO.COM", "guest"); checkTranslation("joe/admin@FOO.COM", "joe"); checkTranslation("joe/root@FOO.COM", "root"); }
@Test public void testToLowerCase() throws Exception { 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@FOO.COM", "joe"); checkTranslation("Joe/root@FOO.COM", "joe"); checkTranslation("Joe/admin@FOO.COM", "joe"); checkTranslation("Joe/guestguest@FOO.COM", "joe"); }
@Test public void testToLowerCase() throws Exception { 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@FOO.COM", "joe"); checkTranslation("Joe/root@FOO.COM", "joe"); checkTranslation("Joe/admin@FOO.COM", "joe"); checkTranslation("Joe/guestguest@FOO.COM", "joe"); }
@Test public void testToLowerCase() throws Exception { 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@FOO.COM", "joe"); checkTranslation("Joe/root@FOO.COM", "joe"); checkTranslation("Joe/admin@FOO.COM", "joe"); checkTranslation("Joe/guestguest@FOO.COM", "joe"); }