this.serviceName = serviceName;
}
public GSSContext run() throws Exception {
GSSManager gssManager = GSSManager.getInstance();
GSSMechanism mechanism = getMechanism();
try {
GSSCredential clientCredential = gssManager.createCredential(
clientName, GSSCredential.DEFAULT_LIFETIME, mechanism.getOid(), GSSCredential.INITIATE_ONLY);
//return gssManager.createContext(clientCredential);
return gssManager.createContext(serviceName, mechanism.getOid(), clientCredential, GSSContext.DEFAULT_LIFETIME);
} catch (GSSException e) {
switch (e.getMajor()) {
case GSSException.BAD_NAME:
case GSSException.CREDENTIALS_EXPIRED:
throw new InvalidCredentialsException(e.getMessage(), e);