Cannot find namespace System.IdentityModel.Services

Viewed 11841

I'm trying to provide user authentication by implementing UserNamePasswordValidator. I have added Microsoft.IdentityModel and System.IdentityModel.Tokens.ValidatingIssuerNameRegistry nuget packages.

I'm getting and error when I implement UserNamePasswordValidator in my class UserAuthentication saying

The type or namespace name Selectors does not exist in namespace System.IdentityModel (are you missing some reference).

Why is this failing?

public class UserAuthentication : System.IdentityModel.Selectors.UserNamePasswordValidator
{
    public override void Validate(string userName, string password)
    {
        try
        {
            if (userName == "test" && password == "test123")
            {
                Console.WriteLine("Authentic User");
            }
        }
        catch (Exception ex)
        {
            throw new FaultException("Unknown Username or Incorrect Password");
        }
    }
}
1 Answers
Related