From 70aaa334bf75d02bf7bbb2f357f2fe8ee665e5ca Mon Sep 17 00:00:00 2001 From: yallie Date: Thu, 5 Dec 2024 21:40:30 +0300 Subject: [PATCH] Authentication should be checked earlier in the server pipeline, close #93. --- CoreRemoting/RemotingSession.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CoreRemoting/RemotingSession.cs b/CoreRemoting/RemotingSession.cs index a31600e..ab5ae79 100644 --- a/CoreRemoting/RemotingSession.cs +++ b/CoreRemoting/RemotingSession.cs @@ -427,6 +427,9 @@ private void ProcessRpcMessage(WireMessage request) { CurrentSession.Value = this; + if (_server.Config.AuthenticationRequired && !_isAuthenticated) + throw new NetworkException("Session is not authenticated."); + var service = _server.ServiceRegistry.GetService(callMessage.ServiceName); var serviceInterfaceType = _server.ServiceRegistry.GetServiceInterfaceType(callMessage.ServiceName); @@ -448,9 +451,6 @@ private void ProcessRpcMessage(WireMessage request) methodName: callMessage.MethodName); oneWay = method.GetCustomAttribute() != null; - - if (_server.Config.AuthenticationRequired && !_isAuthenticated) - throw new NetworkException("Session is not authenticated."); } catch (Exception ex) {