Kerberos DC
fix for automatic credential discarding
@@ -3429,18 +3429,23 @@ public class SQLServerConnection implements ISQLServerConnection {
}
finally {
if (integratedSecurity) {
+ if (null != ImpersonatedUserCred) {
+ try {
+ if (ImpersonatedUserCred.getRemainingLifetime() <= 0) {
if (null != authentication)
authentication.ReleaseClientContext();
authentication = null;
-
- if (null != ImpersonatedUserCred) {
- try {
ImpersonatedUserCred.dispose();
}
+ }
catch (GSSException e) {
if (connectionlogger.isLoggable(Level.FINER))
connectionlogger.finer(toString() + " Release of the credentials failed GSSException: " + e);
}
+ } else {
+ if (null != authentication)
+ authentication.ReleaseClientContext();
+ authentication = null;
}
}
}
