示例#1
0
        private static UrlMatchDictionary <RevaleeUrlAuthorization> LoadUrlAuthorizationSettings(IList <ListenerPrefix> listenerPrefixes)
        {
            var authorizedTargets = new UrlMatchDictionary <RevaleeUrlAuthorization>();

            SecuritySettingsConfigSection section = SecuritySettingsConfigSection.GetConfig();

            if (section != null)
            {
                foreach (UrlAuthorizationElement authorizationElement in section.UrlAuthorizations)
                {
                    var authorization = new RevaleeUrlAuthorization(authorizationElement.UrlPrefix,
                                                                    authorizationElement.FromAddresses,
                                                                    authorizationElement.Retries);

                    if (authorization.UrlPrefix.IsLoopback)
                    {
                        foreach (ListenerPrefix listenerPrefix in listenerPrefixes)
                        {
                            if (authorization.UrlPrefix.Port == listenerPrefix.Port)
                            {
                                throw new ConfigurationErrorsException(string.Format("Cannot authorize callbacks to {0} since that port is used by this service.", authorization.UrlPrefix),
                                                                       authorizationElement.ElementInformation.Source,
                                                                       authorizationElement.ElementInformation.LineNumber);
                            }
                        }
                    }

                    authorizedTargets.Add(authorization.UrlPrefix, authorization);
                }
            }

            return(authorizedTargets);
        }
示例#2
0
 public ConfigurationManager()
 {
     _ServiceName             = LoadServiceNameSettings();
     _ListenerPrefixes        = LoadListenerPrefixSettings();
     _RetryIntervals          = LoadRetryIntervalSettings();
     _AuthorizedTargets       = LoadUrlAuthorizationSettings(_ListenerPrefixes);
     _TaskPersistenceSettings = LoadTaskPersistenceSettings();
 }
示例#3
0
 public void ReloadAuthorizedTargets()
 {
     _AuthorizedTargets = LoadUrlAuthorizationSettings(_ListenerPrefixes);
 }