Search code examples
wcfcustomvalidator

WCF Custom Validator


While setting up a CustomValidator I'm getting the following error:

Could not load file or assembly 'Ringo.Authentication' or one of its dependencies. The system cannot find the file specified.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IdentityModel.Selectors;
using System.IdentityModel.Tokens;
using Ringo.Utilities;


namespace Ringo.Authentication
{
public class CustomUserNameValidator : UserNamePasswordValidator
{
    public override void Validate(string Username, string Password)
    {
        Accounts account = new Accounts();

        if (account.CheckUserAccount(Username, Password))
        {
            return;
        }

        throw new SecurityTokenException("Accout is Invalid");
    }
}
}


      <serviceCredentials >
        <userNameAuthentication userNamePasswordValidationMode="Custom"  customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, Ringo.Authentication"/>
      </serviceCredentials>

Any help would be great thanks!


Solution

  • The Following:

    <serviceCredentials >
        <userNameAuthentication userNamePasswordValidationMode="Custom"  customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, **Ringo.Authentication**"/>
      </serviceCredentials>
    

    Should Be:

          <serviceCredentials >
            <userNameAuthentication userNamePasswordValidationMode="Custom"  customUserNamePasswordValidatorType="Ringo.Authentication.CustomUserNameValidator, **Ringo**"/>
          </serviceCredentials>