/// <summary> Method removeEntry removes SASL/Authenticator data from /// the SASLSession table. Called when sessions terminate, /// or when credentials are 'cleared'. /// </summary> //UPGRADE_NOTE: Synchronized keyword was removed from method 'removeEntry'. Lock expression was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1027"' protected internal virtual void removeEntry(Session session) { lock (this) { if (session == null) throw new SASLException(ERR_INVALID_PARAMETERS); if (session.getPeerCredential() != null) { System.String authenticator = session.getPeerCredential().Authenticator; if ((System.Object) authenticator == null) throw new SASLException(ERR_INVALID_PARAMETERS); SupportClass.HashtableRemove(nameToSession, authenticator); } SupportClass.HashtableRemove(sessionToName, session); session.removeSessionListener(this); printContents(); } }
/// <summary> Method addEntry, adds information to the SASLSession /// table to track what sessions have been authenicated /// with what critera. /// </summary> //UPGRADE_NOTE: Synchronized keyword was removed from method 'addEntry'. Lock expression was added. 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="jlca1027"' protected internal virtual void addEntry(Session session) { lock (this) { bool anonymous = false; if (session == null) throw new SASLException(ERR_INVALID_PARAMETERS); SessionCredential cred = session.getPeerCredential(); if (cred == null) throw new SASLException(ERR_INVALID_PARAMETERS); anonymous = cred.AuthenticatorType.Equals(SASLAnonymousProfile.MECHANISM); // If this session is mapped to another user, get rid of it. System.String authenticator = (System.String) sessionToName[session]; // If it's OTP, store it both ways. if (anonymous) { // This will be in sessionToName by session SupportClass.HashtableRemove(sessionToName, session); } else if ((System.Object) authenticator != null) { SupportClass.HashtableRemove(sessionToName, session); SupportClass.HashtableRemove(nameToSession, authenticator); } // Get the new credential authenticator = session.getPeerCredential().Authenticator; if ((System.Object) authenticator == null) throw new SASLException(ERR_INVALID_PARAMETERS); session.addSessionListener(this); if (sessionToName.Contains(session)) SupportClass.HashtableRemove(nameToSession, authenticator); SupportClass.PutElement(sessionToName, session, authenticator); if (!anonymous) SupportClass.PutElement(nameToSession, authenticator, session); printContents(); } }