public void authenticate(BClient ignored, BAsyncResult <bool> asyncResult) { if (log.isDebugEnabled()) { log.debug("authenticate("); } BAsyncResultIF <bool> outerResult = new MyNegoAsyncResult(client, asyncResult); if (innerAuth != null) { if (log.isDebugEnabled()) { log.debug("innerAuth.authenticate"); } innerAuth.authenticate(client, BAsyncResultHelper.ToDelegate(outerResult)); } else { if (log.isDebugEnabled()) { log.debug("return true"); } outerResult.setAsyncResult(true, null); } if (log.isDebugEnabled()) { log.debug(")authenticate"); } }
internal void internalAuthenticate(BAsyncResultIF <bool> innerResult) { if (log.isDebugEnabled()) { log.debug("internalAuthenticate("); } if (log.isDebugEnabled()) { log.debug("authentication=" + authentication); } if (authentication != null) { authentication.authenticate(null, BAsyncResultHelper.ToDelegate(innerResult)); } else { innerResult.setAsyncResult(false, null); } if (log.isDebugEnabled()) { log.debug(")internalAuthenticate"); } }
internal void internalAuthenticate(BAsyncResultIF <bool> innerResult) { if (log.isDebugEnabled()) { log.debug("internalAuthenticate("); } if (log.isDebugEnabled()) { log.debug("authentication=" + authentication); } if (authentication != null) { bool first = false; bool assumeAuthenticationIsValid = false; lock (asyncResultsWaitingForAuthentication) { DateTime authenticationValidUntil = lastAuthenticationTime.AddMilliseconds(RETRY_AUTHENTICATION_AFTER_MILLIS); assumeAuthenticationIsValid = authenticationValidUntil >= DateTime.Now; if (!assumeAuthenticationIsValid) { first = asyncResultsWaitingForAuthentication.Count == 0; asyncResultsWaitingForAuthentication.Add(innerResult); } } if (log.isDebugEnabled()) { log.debug("first=" + first + ", assumeValid=" + assumeAuthenticationIsValid); } if (first) { InternalAuthenticate_BAsyncResult authResult = new InternalAuthenticate_BAsyncResult(this); authentication.authenticate(null, BAsyncResultHelper.ToDelegate(authResult)); } else if (assumeAuthenticationIsValid) { // Assume that the session is still valid or that // the exception from the last authentication would // be received again at this time. innerResult.setAsyncResult(false, lastAuthenticationException); } else { // innerResult has been added to asyncResultsWaitingForAuthentication // and will be called in InternalAuthenticate_BAsyncResult } } else { innerResult.setAsyncResult(false, null); } if (log.isDebugEnabled()) { log.debug(")internalAuthenticate"); } }