Imports System.IdentityModel.Selectors
Imports System.IdentityModel.Tokens
Public Class CustomUserNameValidator
    Inherits UserNamePasswordValidator

    Public Overrides Sub Validate(ByVal userName As String, ByVal password As String)
        If userName Is Nothing Then
            Throw New ArgumentNullException("username")
        End If

        If password Is Nothing Then
            Throw New ArgumentNullException("password")
        End If
        Dim susername As String = Configuration.ConfigurationManager.AppSettings("ServiceUsername")
        Dim sPassword As String = Configuration.ConfigurationManager.AppSettings("ServicePassword")
        If userName <> susername OrElse password = sPassword Then
            Throw New SecurityTokenException("Unknown Username or Password")
        End If
       
    End Sub
End Class
