示例#1
0
        internal virtual async Task <ReadOnlyMemory <byte> > ProcessMessageCore(ReadOnlySequence <byte> request, Asn1Tag tag)
        {
            KdcMessageHandlerBase messageHandler;

            try
            {
                messageHandler = LocateMessageHandler(request, tag);
            }
            catch (Exception ex)
            {
                logger.LogWarning(ex, "Message handler could not be located for message");

                return(KdcMessageHandlerBase.GenerateGenericError(ex, options));
            }

            try
            {
                return(await messageHandler.Execute());
            }
            catch (Exception ex)
            {
                logger.LogWarning(ex, "Message handler {MessageHandler} could not process message", messageHandler.GetType());

                return(KdcMessageHandlerBase.GenerateGenericError(ex, options));
            }
        }
示例#2
0
        public async Task <ReadOnlyMemory <byte> > ProcessMessage(ReadOnlySequence <byte> request)
        {
            // This should probably only process AS-REQs and TGS-REQs
            // Everything else should fail miserably with an error
            // But we'll leave it to the registered handlers to decide
            // what they are willing to process

            // but we also need to process Kdc Proxy messages

            var tag = PeekTag(request);

            if (tag == Asn1Tag.Sequence && options.ProxyEnabled)
            {
                try
                {
                    return(await ProcessProxyMessage(request));
                }
                catch (Exception ex)
                {
                    logger.LogWarning(ex, "Proxy message could not be parsed correctly");

                    return(KdcMessageHandlerBase.GenerateGenericError(ex, options));
                }
            }

            return(await ProcessMessageCore(request, tag));
        }
示例#3
0
        internal virtual async Task <ReadOnlyMemory <byte> > ProcessMessageCoreAsync(ReadOnlyMemory <byte> request, Asn1Tag tag)
        {
            KdcMessageHandlerBase messageHandler;

            try
            {
                messageHandler = this.LocateMessageHandler(request, tag);
            }
            catch (Exception ex) when(IsProtocolException(ex))
            {
                this.logger.LogWarning(ex, "Message handler could not be located for message");

                return(KdcMessageHandlerBase.GenerateGenericError(ex, this.options));
            }

            try
            {
                return(await messageHandler.ExecuteAsync().ConfigureAwait(false));
            }
            catch (Exception ex) when(IsProtocolException(ex))
            {
                this.logger.LogWarning(ex, "Message handler {MessageHandler} could not process message", messageHandler.GetType());

                return(KdcMessageHandlerBase.GenerateGenericError(ex, this.options));
            }
        }
示例#4
0
        public async Task <ReadOnlyMemory <byte> > ProcessMessage(ReadOnlySequence <byte> request)
        {
            // This should probably only process AS-REQs and TGS-REQs
            // Everything else should fail miserably with an error
            // But we'll leave it to the registered handlers to decide
            // what they are willing to process

            KdcMessageHandlerBase messageHandler;

            try
            {
                messageHandler = LocateMessageHandler(request);

                return(await messageHandler.Execute());
            }
            catch (Exception ex)
            {
                Log(ex);

                return(KdcMessageHandlerBase.GenerateGenericError(ex, options));
            }
        }