public KdcAsReqMessageHandler(ReadOnlySequence <byte> message, ListenerOptions options)
            : base(message, options)
        {
            postProcessAuthHandlers[PaDataType.PA_ETYPE_INFO2] = service => new PaDataETypeInfo2Handler(service);

            RegisterPreAuthHandlers(postProcessAuthHandlers);
        }
Exemplo n.º 2
0
        public KdcTgsReqMessageHandler(ReadOnlyMemory <byte> message, ListenerOptions options)
            : base(message, options)
        {
            logger = options.Log.CreateLoggerSafe <KdcTgsReqMessageHandler>();

            PreAuthHandlers[PaDataType.PA_TGS_REQ] = service => new PaDataTgsTicketHandler(service);
        }
Exemplo n.º 3
0
 protected ServiceListenerBase(
     ListenerOptions options,
     Func <Socket, ListenerOptions, SocketWorkerBase> workerFunc
     )
 {
     this.options   = options;
     socketListener = new SocketListener(options, workerFunc);
 }
Exemplo n.º 4
0
        public KdcServer(ListenerOptions options)
        {
            this.options = options;

            RegisterMessageHandler(MessageType.KRB_AS_REQ, (message, op) => new KdcAsReqMessageHandler(message, op));
            RegisterMessageHandler(MessageType.KRB_TGS_REQ, (message, op) => new KdcTgsReqMessageHandler(message, op));

            RegisterPreAuthHandler(PaDataType.PA_ENC_TIMESTAMP, (service) => new PaDataTimestampHandler(service));
        }
Exemplo n.º 5
0
        public KdcAsReqMessageHandler(ReadOnlyMemory <byte> message, ListenerOptions options)
            : base(message, options)
        {
            this.logger = options.Log.CreateLoggerSafe <KdcAsReqMessageHandler>();

            PostProcessAuthHandlers[PaDataType.PA_ETYPE_INFO2] = service => new PaDataETypeInfo2Handler(service);

            RegisterPreAuthHandlers(PostProcessAuthHandlers);
        }
Exemplo n.º 6
0
        protected ServiceListenerBase(
            ListenerOptions options,
            Func <Socket, ListenerOptions, SocketWorkerBase> workerFunc
            )
        {
            Options = options;

            logger         = options.Log.CreateLoggerSafe <ServiceListenerBase>();
            socketListener = new SocketListener(options, workerFunc);
        }
Exemplo n.º 7
0
        public SocketListener(ListenerOptions options, Func <Socket, ListenerOptions, SocketWorkerBase> workerFunc)
            : base(options)
        {
            listeningSocket = new Socket(SocketType.Stream, ProtocolType.Tcp);

            listeningSocket.Bind(Options.ListeningOn);
            listeningSocket.Listen(Options.QueueLength);

            this.workerFunc = workerFunc;
        }
Exemplo n.º 8
0
        public KdcServer(ListenerOptions options)
        {
            this.options = options;
            this.logger  = options.Log.CreateLoggerSafe <KdcServer>();

            RegisterMessageHandler(MessageType.KRB_AS_REQ, (message, op) => new KdcAsReqMessageHandler(message, op));
            RegisterMessageHandler(MessageType.KRB_TGS_REQ, (message, op) => new KdcTgsReqMessageHandler(message, op));

            RegisterPreAuthHandler(PaDataType.PA_ENC_TIMESTAMP, (service) => new PaDataTimestampHandler(service));
            RegisterPreAuthHandler(PaDataType.PA_PK_AS_REQ, (service) => new PaDataPkAsReqHandler(service));
        }
Exemplo n.º 9
0
        internal static ReadOnlyMemory <byte> GenerateGenericError(Exception ex, ListenerOptions options)
        {
            KerberosErrorCode error     = KerberosErrorCode.KRB_ERR_GENERIC;
            string            errorText = options.IsDebug ? $"[Server] {ex}" : null;

            if (ex is KerberosProtocolException kex)
            {
                error     = kex.Error.ErrorCode;
                errorText = kex.Message;
            }

            return(GenerateError(error, errorText, options.DefaultRealm, "krbtgt"));
        }
Exemplo n.º 10
0
        public SocketListener(ListenerOptions options, Func <Socket, ListenerOptions, SocketWorkerBase> workerFunc)
            : base(options)
        {
            logger = options.Log.CreateLoggerSafe <SocketListener>();

            listeningSocket = new Socket(SocketType.Stream, ProtocolType.Tcp);

            listeningSocket.Bind(Options.ListeningOn);
            listeningSocket.Listen(Options.QueueLength);

            logger.LogInformation("Listener has started. Endpoint = {Port}; Protocol = {Protocol}", listeningSocket.LocalEndPoint, listeningSocket.ProtocolType);

            this.workerFunc = workerFunc;
        }
Exemplo n.º 11
0
        protected SocketWorkerBase(Socket socket, ListenerOptions options)
            : base(options)
        {
            this.socket = socket;

            RequestPipe = new Pipe(new PipeOptions(
                                       readerScheduler: scheduler,
                                       writerScheduler: scheduler,
                                       pauseWriterThreshold: options.MaxReadBufferSize,
                                       resumeWriterThreshold: options.MaxReadBufferSize / 2,
                                       useSynchronizationContext: false
                                       ));

            ResponsePipe = new Pipe(new PipeOptions(
                                        readerScheduler: scheduler,
                                        writerScheduler: scheduler,
                                        pauseWriterThreshold: options.MaxWriteBufferSize,
                                        resumeWriterThreshold: options.MaxWriteBufferSize / 2,
                                        useSynchronizationContext: false
                                        ));
        }
Exemplo n.º 12
0
 public KdcServiceListener(ListenerOptions options)
     : base(options, (socket, o) => new KdcSocketWorker(socket, o))
 {
 }
Exemplo n.º 13
0
 protected KdcMessageHandlerBase(ReadOnlyMemory <byte> message, ListenerOptions options)
 {
     this.message = message;
     Options      = options;
 }
Exemplo n.º 14
0
 protected SocketWorkerBase(Socket socket, ListenerOptions options)
     : base(options)
 {
     this.socket = socket;
     this.logger = options.Log.CreateLoggerSafe <SocketWorkerBase>();
 }
Exemplo n.º 15
0
 public KdcTgsReqMessageHandler(ReadOnlySequence <byte> message, ListenerOptions options)
     : base(message, options)
 {
     logger = options.Log.CreateLoggerSafe <KdcTgsReqMessageHandler>();
 }
Exemplo n.º 16
0
 public KdcSocketWorker(Socket socket, ListenerOptions options)
     : base(socket, options)
 {
     kdc = new KdcServer(options);
 }
Exemplo n.º 17
0
 protected SocketBase(ListenerOptions options)
 {
     this.Options = options;
 }
Exemplo n.º 18
0
 public KdcSocketWorker(Socket socket, ListenerOptions options)
     : base(socket, options)
 {
     kdc    = new KdcServer(options);
     logger = options.Log.CreateLoggerSafe <KdcSocketWorker>();
 }
Exemplo n.º 19
0
 public KdcTgsReqMessageHandler(ReadOnlySequence <byte> message, ListenerOptions options)
     : base(message, options)
 {
 }