Exemplo n.º 1
0
        public StsTokenService(StsTokenServiceConfiguration config)
        {
            // Check input arguments
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            if (string.IsNullOrEmpty(config.WspEndpointId))
            {
                throw new ArgumentException("WspEndpointId");
            }
            if (string.IsNullOrEmpty(config.StsEndpointAddress))
            {
                throw new ArgumentException("StsEndpointAddress");
            }
            // X509FindType cannot be tested below because default value is FindByThumbprint
            if (config.ClientCertificate == null)
            {
                throw new ArgumentException("ClientCertificate");
            }
            if (config.StsCertificate == null)
            {
                throw new ArgumentException("StsCertificate");
            }

            // New object is created to ensure that configuration does not change. The alternative would be immutable objects.
            _config = new StsTokenServiceConfiguration
            {
                ClientCertificate      = config.ClientCertificate,
                StsCertificate         = config.StsCertificate,
                SendTimeout            = config.SendTimeout,
                StsEndpointAddress     = config.StsEndpointAddress,
                TokenLifeTimeInMinutes = config.TokenLifeTimeInMinutes,
                WspEndpointId          = config.WspEndpointId
            };
        }
Exemplo n.º 2
0
 public StsTokenServiceCache(StsTokenServiceConfiguration config)
 {
     _stsTokenService = new StsTokenService(config);
     _cacheClockSkew  = config.CacheClockSkew;
     _wspEndpointId   = config.WspEndpointId;
 }