I am still stuck with this problem, although here is the idea behind what I want to accomplish... This could work (after some refinement) but I am sure that it is not the right way - there would be some serious limitations.
I implement a custom username validator:
<serviceCredentials>
<userNameAuthentication
userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="Services.Authentication.CustomValidators.CustomUserNameValidator, Services"
/>
public class CustomUserNameValidator : UserNamePasswordValidator
{
public static Dictionary<string, string> Passwords;
public override void Validate(string userName, string password)
{
if (!Passwords.ContainsKey(userName))
Passwords.Add(userName, password);
}
}
I would then be able to retrieve the password for the user in my service methods:
Console.WriteLine(CustomUserNameValidator.Passwords[ServiceSecurityContext.Current.PrimaryIdentity.Name]);