I have a WCF service where I use customUserNamePasswordValidatorType (specified in the \ serviceBehaviors \ serviceCredentials \ userNameAuthentication behavior section of the web.config file).
My custom UserNamePasswordValidator works this way:
public bool Authenticate(string userName, string password)
{
If ( IsUserValid(username, password) )
{
UserInfo currentUser = CreateUserInfo(username);
return true;
}
return false;
}
While making a service call, I need to access authenticated user information. For example, I would like to be able to implement:
public class MyService : IService
{
public string Service1()
{
return "Hello" + currentUser.Name;
}
}
My question is how and where to store information during the authentication process so that it can be obtained during the call process? This storage should continue as long as the "session" is valid.
, ( ) / . , SecuritytContext, safeSessions .
, ASP.NET HttpContext.Current.Session, , , .