public KerberosServiceContext run() throws GSSException, WSSecurityException {
GSSManager gssManager = GSSManager.getInstance();
Oid kerberos5Oid = new Oid(JGSS_KERBEROS_TICKET_OID);
GSSName gssService = gssManager.createName(serviceName, isUsernameServiceNameForm ? GSSName.NT_USER_NAME : GSSName.NT_HOSTBASED_SERVICE);
GSSCredential credentials =
gssManager.createCredential(
gssService, GSSCredential.DEFAULT_LIFETIME, kerberos5Oid, GSSCredential.ACCEPT_ONLY
);
KerberosServiceContext krbServiceCtx = null;
GSSContext secContext = null;
try{
secContext = gssManager.createContext(credentials);
secContext.acceptSecContext(ticket, 0, ticket.length);
krbServiceCtx = new KerberosServiceContext();
GSSName clientName = secContext.getSrcName();
krbServiceCtx.setPrincipal(new KerberosPrincipal(clientName.toString()));
if (!isJava5Or6 && (isOracleJavaVendor || isIBMJavaVendor)) {
try {
@SuppressWarnings("rawtypes")
Class inquireType = Class.forName(isOracleJavaVendor ? SUN_JGSS_INQUIRE_TYPE_CLASS : IBM_JGSS_INQUIRE_TYPE_CLASS);