コード例 #1
0
 private static void InitializeIfNeeded()
 {
     if (!FederationTrustCache.IsInitialized())
     {
         lock (FederationTrustCache.locker)
         {
             if (!FederationTrustCache.IsInitialized())
             {
                 FederationTrustCache.timeout = DateTime.UtcNow + FederationTrustCache.ExpirationTime;
                 try
                 {
                     FederationTrustCache.LoadFederationTrust();
                     FederationTrustCache.SubscribeForNotifications();
                 }
                 catch (LocalizedException arg)
                 {
                     FederationTrustCache.Tracer.TraceError <LocalizedException>(0L, "FederationTrustCache: Unable to initialize due exception: {0}", arg);
                 }
                 if (FederationTrustCache.notification != null)
                 {
                     FederationTrustCache.timeout = DateTime.MaxValue;
                 }
                 FederationTrustCache.initialized = true;
             }
         }
     }
 }
コード例 #2
0
        public static FederationTrust GetFederationTrust(string name)
        {
            FederationTrustCache.InitializeIfNeeded();
            FederationTrust result;

            if (FederationTrustCache.dictionaryByCommonName.TryGetValue(name, out result))
            {
                return(result);
            }
            return(null);
        }
コード例 #3
0
        public static FederationTrust GetFederationTrust(ADObjectId id)
        {
            FederationTrustCache.InitializeIfNeeded();
            FederationTrust result;

            if (FederationTrustCache.dictionaryByADObjectId.TryGetValue(id, out result))
            {
                return(result);
            }
            return(null);
        }
コード例 #4
0
 private static void NotificationHandler(ADNotificationEventArgs args)
 {
     FederationTrustCache.Tracer.TraceDebug(0L, "FederationTrustCache: changes detected in configuration in AD.");
     try
     {
         FederationTrustCache.LoadFederationTrust();
     }
     catch (LocalizedException arg)
     {
         FederationTrustCache.Tracer.TraceError <LocalizedException>(0L, "FederationTrustCache: failed to read federation trust from AD due exception: {0}", arg);
         return;
     }
     if (FederationTrustCache.Change != null)
     {
         FederationTrustCache.Tracer.TraceDebug(0L, "FederationTrustCache: notifying subscribers of change.");
         FederationTrustCache.Change();
     }
 }
コード例 #5
0
 internal static void Initialize()
 {
     FederationTrustCache.LoadFederationTrust();
 }
コード例 #6
0
 public static IEnumerable <FederationTrust> GetFederationTrusts()
 {
     FederationTrustCache.InitializeIfNeeded();
     return(new List <FederationTrust>(FederationTrustCache.dictionaryByADObjectId.Values));
 }