I have a service that uses a custom “UserNamePasswordValidator” and need to save the validated user object to be able to retrieve it later in the service. How can I do this? Or how can I access the credentials of the user later in the service?
/Viktor
The short answer is that the most correct option is to create an IPrincipal instance that represents the authenticated user and put it on Thread.CurrentPrincipal.
All code running on the same thread later in the service will be able to access the authenticated user through Thread.CurrentPrincipal.
This is the standard way of dealing with authenticated users in .NET (and therefore also in WCF).