How to personalize Nservicebus

Hi How to personalize Nservicebus. I am using Nservicebus version 5.2.

I see the code of the old version, but not available in the new version. We have a sample that shows itself in version 5.2.

Configure.With() .StructureMapBuilder() .Sagas() .RunTimeoutManager() .UnicastBus() .ImpersonateSender(false) 

There is no way to install in the new version

ImpersonateSender

Does anyone know how to pass the exact currentprincipal object to endpoints?

I tried to run the endpoint below the command line. Start NServiceBus.Host.exe /displayName:"myservice" /username:"mydomain\myname" /password:"mypwd"

However, when I register a username, it does not select the same username that I used to run the endpoint.

  public void Customize(BusConfiguration configuration) { configuration.UsePersistence<RavenDBPersistence>() Console.WriteLine("-------------------NAME--------------\n"); Console.WriteLine(WindowsIdentity.GetCurrent().Name); Console.WriteLine("-------------------NAME--------------\n"); Console.WriteLine("-------------------NAME--------------\n"); Console.WriteLine(Thread.CurrentPrincipal.Identity.Name); Console.WriteLine("-------------------NAME--------------\n"); } 

the output comes as: ------------------- NAME --------------

MYNetworkDomain \ MyMachineLoggedInNTId ------------------- NAME --------------

------------------- NAME --------------

------------------- NAME --------------

+1
source share
1 answer

Avatar in .Net can have many tastes and cannot behave as you might expect. In version 4, when .ImpersonateSender(...) was set to true, the behavior was to be delivered with the message using the message header, the identity name used at the sender endpoint, the recipient would use the header of the incoming message to configure a new generic identity .

This is not a real impersonation, not to mention that the impersonation for working on different machines requires that delegation be configured taking into account all the security problems that the delegation brings to the table. Not to mention the fact that AFAIK, the impersonation of Windows Identity cannot be performed at the thread level, the security token is connected to the process and cannot be overwritten by a thread pretending to be another user.

However, there is nothing stopping you from creating your own identity delivery logic along with messages so that you have the .Net authentication / core infrastructure configuration of your choice and be able to perform security checks through the Role infrastructure.

0
source

Source: https://habr.com/ru/post/1309962/


All Articles