示例#1
0
        public static KdcListener StartListener(
            int port,
            bool slow            = false,
            bool allowWeakCrypto = false,
            string realm         = "corp2.identityintervention.com"
            )
        {
            KdcServerOptions options = null;

            options = new KdcServerOptions
            {
                DefaultRealm = realm.ToUpper(CultureInfo.InvariantCulture),
                IsDebug      = true,
                RealmLocator = realm => LocateRealm(realm, slow, options.Configuration)
            };

            options.Configuration.Defaults.AllowWeakCrypto   = allowWeakCrypto;
            options.Configuration.KdcDefaults.ReceiveTimeout = TimeSpan.FromHours(1);
            options.Configuration.KdcDefaults.KdcTcpListenEndpoints.Clear();
            options.Configuration.KdcDefaults.KdcTcpListenEndpoints.Add($"127.0.0.1:{port}");

            var server = new KdcServer(options);

            server.RegisterPreAuthHandler(
                PaDataType.PA_PK_AS_REQ,
                service => new PaDataPkAsReqHandler(service)
            {
                IncludeOption = X509IncludeOption.EndCertOnly
            }
                );

            return(new KdcListener(server));
        }
示例#2
0
        public static KdcListener StartListener(int port, bool slow = false)
        {
            var options = new KdcServerOptions
            {
                ListeningOn    = new IPEndPoint(IPAddress.Loopback, port),
                DefaultRealm   = "corp2.identityintervention.com".ToUpper(CultureInfo.InvariantCulture),
                IsDebug        = true,
                RealmLocator   = realm => LocateRealm(realm, slow),
                ReceiveTimeout = TimeSpan.FromHours(1)
            };

            var server = new KdcServer(options);

            server.RegisterPreAuthHandler(
                PaDataType.PA_PK_AS_REQ,
                service => new PaDataPkAsReqHandler(service)
            {
                IncludeOption = X509IncludeOption.EndCertOnly
            }
                );

            return(new KdcListener(server));
        }