WCF Authentication RRS feed

  • Question

  • Hi,

    I have implemented Custom Authentication with UserNamePasswordValidator.

    According to project requirement, I require four input parameters for authentication(Username, Password, SiteID, BrandID).

    But Validate Method accept only two parameters: Validate(string userName, string password)


    1) How can I send more than two parameters to Validate Method?

    2) Is there any other approach to define WCF Authentication with own validate methods?

    Thank You,


    Tuesday, November 3, 2015 4:57 AM


  • Hi Ram02455,

    According to this case, As far as I know, we can sent more than two parameters to

    Validate method.

    Because, when we inheritance the UserNamePasswordValidator class, we can overload

    the validate Method with more parameters . Then we can override the validate method

    like below:

    class MyValidator:UserNamePasswordValidator
            public abstract void validate(string username, string passWord, int Id, int ID)
            public override void Validate(string userName, string password,int  SiteID, int BrandID)
                //the follow code is testing only.u can read userName and password from DataBase.
                if (userName != "user" || password != "pwd" || SiteID!=1||BrandID!=2)
                    throw new Exception("Unknown Username or Password");

    Best Regards,


    Wednesday, November 4, 2015 6:19 AM