private static TcpPackage CreateWriteRequestPackage(TcpCommand command, ClientMessage.WriteRequestMessage msg, object dto) { // we forwarding with InternalCorrId, not client's CorrelationId!!! return(msg.Login != null && msg.Password != null ? new TcpPackage(command, TcpFlags.Authenticated, msg.InternalCorrId, msg.Login, msg.Password, dto.Serialize()) : new TcpPackage(command, TcpFlags.None, msg.InternalCorrId, null, null, dto.Serialize())); }
private static TcpPackage CreateWriteRequestPackage(TcpCommand command, ClientMessage.WriteRequestMessage msg, object dto) { // we forwarding with InternalCorrId, not client's CorrelationId!!! if (msg.User == UserManagement.SystemAccount.Principal) { return(new TcpPackage(command, TcpFlags.TrustedWrite, msg.InternalCorrId, null, null, dto.Serialize())); } return(msg.Login != null && msg.Password != null ? new TcpPackage(command, TcpFlags.Authenticated, msg.InternalCorrId, msg.Login, msg.Password, dto.Serialize()) : new TcpPackage(command, TcpFlags.None, msg.InternalCorrId, null, null, dto.Serialize())); }
private static TcpPackage CreateWriteRequestPackage <T>(TcpCommand command, ClientMessage.WriteRequestMessage msg, T dto) where T : IMessage <T> { // we forwarding with InternalCorrId, not client's CorrelationId!!! if (msg.User == UserManagement.SystemAccounts.System) { return(new TcpPackage(command, TcpFlags.TrustedWrite, msg.InternalCorrId, null, null, dto.Serialize())); } foreach (var identity in msg.User.Identities) { if (!(identity is DelegatedClaimsIdentity dci)) { continue; } var jwtClaim = dci.FindFirst("jwt"); if (jwtClaim != null) { return(new TcpPackage(command, TcpFlags.Authenticated, msg.InternalCorrId, jwtClaim.Value, dto.Serialize())); } var uidClaim = dci.FindFirst("uid"); var pwdClaim = dci.FindFirst("pwd"); if (uidClaim != null && pwdClaim != null) { return(new TcpPackage(command, TcpFlags.Authenticated, msg.InternalCorrId, uidClaim.Value, pwdClaim.Value, dto.Serialize())); } } return(msg.Login != null && msg.Password != null ? new TcpPackage(command, TcpFlags.Authenticated, msg.InternalCorrId, msg.Login, msg.Password, dto.Serialize()) : new TcpPackage(command, TcpFlags.None, msg.InternalCorrId, null, null, dto.Serialize())); }
private void ForwardRequest(ClientMessage.WriteRequestMessage msg, Message timeoutMessage) { _forwardingProxy.Register(msg.InternalCorrId, msg.CorrelationId, msg.Envelope, _forwardingTimeout, timeoutMessage); _outputBus.Publish(new ClientMessage.TcpForwardMessage(msg)); }