Package org.ietf.jgss

Examples of org.ietf.jgss.GSSException


        return subject.equals(((GSSUPNameSpi)name).subject);
    }

    public byte[] export() throws GSSException
    {
        throw new GSSException(GSSException.FAILURE, GSSException.FAILURE, "Not Implemented");
        /*
        //System.out.println("GSSUPNameSpi.export");
        Any any = ((GSSUPProvider)provider).getORB().create_any();
        InitialContextTokenHelper.insert( any, subject );
        byte[] out = new byte[0];
View Full Code Here


  private Oid nameType;
 
  public KerberosName(String name, Oid nameType) throws GSSException {
    if (null == name) {
      throw new GSSException(KerberosUtils.DEFAULT_GSSEXCEPTION_MAJOR_CODE,
          KerberosUtils.DEFAULT_GSSEXCEPTION_MINOR_CODE,
          "Cannot import null GSSName");
    }

    if (null == nameType) {
      nameType = KerberosUtils.KRB5_PRINCIPAL_NAMETYPE;
    }
   
    if(nameType.equals(GSSName.NT_HOSTBASED_SERVICE)){
      name = name.replaceAll("@", "/");
    }
   
    if (!(nameType.equals(GSSName.NT_HOSTBASED_SERVICE)
        || nameType.equals(GSSName.NT_USER_NAME) || nameType
        .equals(KerberosUtils.KRB5_PRINCIPAL_NAMETYPE))) {
      throw new GSSException(
          KerberosUtils.DEFAULT_GSSEXCEPTION_MAJOR_CODE,
          KerberosUtils.DEFAULT_GSSEXCEPTION_MINOR_CODE,
          "Unsupported OID");
    }
    this.name = name;
View Full Code Here

 
  public static String toString(byte[] bytes) throws GSSException {
    try {
      return new String(bytes, DEFAULT_CHARSET_NAME);
    } catch (UnsupportedEncodingException e) {
      throw new GSSException(DEFAULT_GSSEXCEPTION_MAJOR_CODE,
          DEFAULT_GSSEXCEPTION_MINOR_CODE, e.getMessage());
    }
  }
View Full Code Here

  public static byte[] getBytes(String s) throws GSSException {
    try {
      return s.getBytes(DEFAULT_CHARSET_NAME);
    } catch (UnsupportedEncodingException e) {
      throw new GSSException(DEFAULT_GSSEXCEPTION_MAJOR_CODE,
          DEFAULT_GSSEXCEPTION_MINOR_CODE, e.getMessage());
    }
  }
View Full Code Here

    byte[] encoded = encodedGSSName;
    int index = 0;

    if (encoded[index++] != EXPORTED_TOKEN_FIRST_BYTE
        || encoded[index++] != EXPORTED_TOKEN_SECOND_BYTE) {
      throw new GSSException(GSSUtils.DEFAULT_GSSEXCEPTION_MAJOR_CODE,
          GSSUtils.DEFAULT_GSSEXCEPTION_MINOR_CODE,
          "Illegal token in importing string to GSSName");
    }

    int oidLength = GSSUtils.toInt(encoded, index,
View Full Code Here

      mech = managerImpl.getDefaultMech();
    }

    GSSCredentialType credentialType = new GSSCredentialType(mech, usage);
    if (credentials.containsKey(credentialType)) {
      throw new GSSException(GSSException.DUPLICATE_ELEMENT,
          GSSUtils.DEFAULT_GSSEXCEPTION_MINOR_CODE, mech + " "
              + usage);
    }

    GSSCredentialElement credentialElement = managerImpl
View Full Code Here

        credential = entry.getValue();
        break;
      }
    }
    if (null == credential) {
      throw new GSSException(GSSException.BAD_MECH,
          GSSUtils.DEFAULT_GSSEXCEPTION_MINOR_CODE,
          "fail to get name for " + mech);
    }
    return credential.getName();
  }
View Full Code Here

      remainingAcceptLifetime = Math.max(remainingAcceptLifetime,
          credential.getRemainingAcceptLifetime());
    }

    if (credential == null) {
      throw new GSSException(GSSException.BAD_MECH,
          GSSUtils.DEFAULT_GSSEXCEPTION_MINOR_CODE,
          "no credential for mech " + mech);
    }
    return remainingAcceptLifetime;
  }
View Full Code Here

      remainingInitLifetime = Math.max(remainingInitLifetime, credential
          .getRemainingInitLifetime());
    }

    if (credential == null) {
      throw new GSSException(GSSException.BAD_MECH,
          GSSUtils.DEFAULT_GSSEXCEPTION_MINOR_CODE,
          "no credential for mech " + mech);
    }
    return remainingInitLifetime;
  }
View Full Code Here

      return GSSCredential.INITIATE_ONLY;
    }
    if (isAccept) {
      return GSSCredential.ACCEPT_ONLY;
    }
    throw new GSSException(GSSException.FAILURE,
        GSSUtils.DEFAULT_GSSEXCEPTION_MINOR_CODE,
        "no credential element in this credential");
  }
View Full Code Here

TOP

Related Classes of org.ietf.jgss.GSSException

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.