Package org.apache.harmony.auth.jgss.kerberos

Examples of org.apache.harmony.auth.jgss.kerberos.KerberosName


public class KerberosNameTest extends TestCase {

 
  public void testExport() throws Exception {
    KerberosName kerberosName = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
    byte[] exported = kerberosName.export();
    byte[] expected = new byte[] { 4,1,0,11,6,9,42,-122,72,-122,-9,18,1,2,2,0,0,0,17,115,101,114,118,105,99,101,47,108,111,99,97,108,104,111,115,116 };
    assertTrue(Arrays.equals(expected, exported));   
  }
View Full Code Here


    byte[] expected = new byte[] { 4,1,0,11,6,9,42,-122,72,-122,-9,18,1,2,2,0,0,0,17,115,101,114,118,105,99,101,47,108,111,99,97,108,104,111,115,116 };
    assertTrue(Arrays.equals(expected, exported));   
  }
 
  public void testEquals() throws Exception{
    KerberosName one = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
    KerberosName another = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
    assertEquals(one, another);
   
    one = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
    another = new KerberosName("service/localhost", GSSName.NT_HOSTBASED_SERVICE);
    assertEquals(one, another);
   
    one = new KerberosName("service@localhost", GSSName.NT_USER_NAME);
    another = new KerberosName("service@localhost", GSSName.NT_USER_NAME);
    assertEquals(one, another);
   
    one = new KerberosName("service@localhost", GSSName.NT_USER_NAME);
    another = new KerberosName("service/localhost", GSSName.NT_USER_NAME);
    assertFalse(one.equals(another));
   
    final Oid KRB5_PRINCIPAL_NAMETYPE = new Oid("1.2.840.113554.1.2.2.1");
    one = new KerberosName("service@localhost", KRB5_PRINCIPAL_NAMETYPE);
    another = new KerberosName("service@localhost", KRB5_PRINCIPAL_NAMETYPE);
    assertEquals(one, another);
   
    one = new KerberosName("service@localhost", KRB5_PRINCIPAL_NAMETYPE);
    another = new KerberosName("service/localhost",KRB5_PRINCIPAL_NAMETYPE);
    assertFalse(one.equals(another));
   
    one = new KerberosName("service@localhost", KRB5_PRINCIPAL_NAMETYPE);
    another = new KerberosName("service@localhost", GSSName.NT_USER_NAME);
    assertEquals(one,another);
   
    one = new KerberosName("service@localhost", KRB5_PRINCIPAL_NAMETYPE);
    another = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
    assertFalse(one.equals(another));
   
    one = new KerberosName("service/localhost", KRB5_PRINCIPAL_NAMETYPE);
    another = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
    assertEquals(one,another);
   
    one = new KerberosName("service@localhost", GSSName.NT_USER_NAME);
    another = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
    assertFalse(one.equals(another));
   
    one = new KerberosName("service/localhost", GSSName.NT_USER_NAME);
    another = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
    assertFalse(one.equals(another));
  }
View Full Code Here

TOP

Related Classes of org.apache.harmony.auth.jgss.kerberos.KerberosName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.