Package org.apache.harmony.auth.internal.kerberos.v5

Examples of org.apache.harmony.auth.internal.kerberos.v5.PrincipalName


     * file or via the java.security.krb5.realm system property.
     */

    public KerberosPrincipal(String name, int nameType) {

  PrincipalName krb5Principal = null;

  try {
      // Appends the default realm if it is missing
      krb5Principal  = new PrincipalName(name,nameType);
  } catch (KrbException e) {
      throw new IllegalArgumentException(e.getMessage());
  }
  
  this.nameType = nameType;
  fullName = krb5Principal.toString();
  realm = krb5Principal.getRealmString();
    }
View Full Code Here


     */

    private void writeObject(ObjectOutputStream oos)
  throws IOException {

  PrincipalName krb5Principal = null;
  try {
      krb5Principal  = new PrincipalName(fullName,nameType);
      oos.writeObject(krb5Principal.asn1Encode());
      oos.writeObject(krb5Principal.getRealm().asn1Encode());
  } catch (Exception e) {
      IOException ioe = new IOException(e.getMessage());
      ioe.initCause(e);
      throw ioe;
  }
View Full Code Here

    private void readObject(ObjectInputStream ois)
   throws IOException, ClassNotFoundException {
  byte[] asn1EncPrincipal = (byte [])ois.readObject();
  byte[] encRealm = (byte [])ois.readObject();
  try {
     PrincipalName krb5Principal = new PrincipalName(new
            DerValue(asn1EncPrincipal));
     realm = (new Realm(new DerValue(encRealm))).toString();
     fullName = krb5Principal.toString() + NAME_REALM_SEPARATOR +
       realm.toString();
     nameType = krb5Principal.getNameType();
  } catch (Exception e) {
      IOException ioe = new IOException(e.getMessage());
      ioe.initCause(e);
      throw ioe;
  }
View Full Code Here

    String serviceName = "host/" + remoteHost.getHost();
    if (LOG.isDebugEnabled())
      LOG.debug("Fetching service ticket for host at: " + serviceName);
    Credentials serviceCred = null;
    try {
      PrincipalName principal = new PrincipalName(serviceName,
          PrincipalName.KRB_NT_SRV_HST);
      serviceCred = Credentials.acquireServiceCreds(principal
          .toString(), Krb5Util.ticketToCreds(getTgtFromSubject()));
    } catch (Exception e) {
      throw new IOException("Can't get service ticket for: "
          + serviceName, e);
    }
View Full Code Here

    String serviceName = "host/" + remoteHost.getHost();
    if (LOG.isDebugEnabled())
      LOG.debug("Fetching service ticket for host at: " + serviceName);
    Credentials serviceCred = null;
    try {
      PrincipalName principal = new PrincipalName(serviceName,
          PrincipalName.KRB_NT_SRV_HST);
      serviceCred = Credentials.acquireServiceCreds(principal
          .toString(), Krb5Util.ticketToCreds(getTgtFromSubject()));
    } catch (Exception e) {
      throw new IOException("Can't get service ticket for: "
          + serviceName, e);
    }
View Full Code Here

    public KeyImpl(KerberosPrincipal principal,
                   char[] password,
                   String algorithm) {

        try {
            PrincipalName princ = new PrincipalName(principal.getName());
            EncryptionKey key =
                new EncryptionKey(password, princ.getSalt(), algorithm);
            this.keyBytes = key.getBytes();
            this.keyType = key.getEType();
        } catch (KrbException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
View Full Code Here

     * access to the keytab file is not permitted
     */
    public KerberosKey[] getKeys(KerberosPrincipal principal) {
        try {
            EncryptionKey[] keys = takeSnapshot().readServiceKeys(
                    new PrincipalName(principal.getName()));
            KerberosKey[] kks = new KerberosKey[keys.length];
            for (int i=0; i<kks.length; i++) {
                Integer tmp = keys[i].getKeyVersionNumber();
                kks[i] = new KerberosKey(
                        principal,
View Full Code Here

     * in either a Kerberos configuration file or via the
     * java.security.krb5.realm system property.
     */
    public KerberosPrincipal(String name) {

        PrincipalName krb5Principal = null;

        try {
            // Appends the default realm if it is missing
            krb5Principal = new PrincipalName(name, KRB_NT_PRINCIPAL);
        } catch (KrbException e) {
            throw new IllegalArgumentException(e.getMessage());
        }
        nameType = KRB_NT_PRINCIPAL;  // default name type
        fullName = krb5Principal.toString();
        realm = krb5Principal.getRealmString();
    }
View Full Code Here

     * file or via the java.security.krb5.realm system property.
     */

    public KerberosPrincipal(String name, int nameType) {

        PrincipalName krb5Principal = null;

        try {
            // Appends the default realm if it is missing
            krb5Principal  = new PrincipalName(name,nameType);
        } catch (KrbException e) {
            throw new IllegalArgumentException(e.getMessage());
        }

        this.nameType = nameType;
        fullName = krb5Principal.toString();
        realm = krb5Principal.getRealmString();
    }
View Full Code Here

     */

    private void writeObject(ObjectOutputStream oos)
        throws IOException {

        PrincipalName krb5Principal = null;
        try {
            krb5Principal  = new PrincipalName(fullName,nameType);
            oos.writeObject(krb5Principal.asn1Encode());
            oos.writeObject(krb5Principal.getRealm().asn1Encode());
        } catch (Exception e) {
            IOException ioe = new IOException(e.getMessage());
            ioe.initCause(e);
            throw ioe;
        }
View Full Code Here

TOP

Related Classes of org.apache.harmony.auth.internal.kerberos.v5.PrincipalName

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.