Main Page | Report this Page
.NET DotNet Forum Index  »  ASP.NET - Webservices Forum  »  custom UserName validator not being executed...
Page 1 of 1    

custom UserName validator not being executed...

Author Message
Houston...
Posted: Sat Aug 15, 2009 9:24 am
Guest
I'm trying to use basicHttpBinding with TransportWithMessageCredential and a
custom username validator. The validator is not being executed. I'm sure
I've got a config problem but can't see where. web.config and code follow.
Thanks in advance for any help you can offer.

--Houston

--------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingConfig">
<security mode="TransportWithMessageCredential" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="ToteServiceBehavior"
name="ToteServiceLibrary.ToteDataService">
<endpoint address="mex" binding="mexHttpsBinding"
contract="IMetadataExchange" />
<endpoint address="basic" binding="basicHttpBinding"
bindingConfiguration="basicHttpBindingConfig"
contract="ToteServiceLibrary.iToteDataService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ToteServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<serviceCertificate findValue="snark.mydomain.com"
storeLocation="LocalMachine"
storeName="My" x509FindType="FindBySubjectName" />
<userNameAuthentication userNamePasswordValidationMode="Custom"
includeWindowsGroups="false"
customUserNamePasswordValidatorType="ToteServiceLibrary.CustomUserNameValidator,ToteServiceLibrary" />
<windowsAuthentication includeWindowsGroups="false" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.diagnostics>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="myListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="c:\inetpub\trace\SecureToteService.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>


namespace ToteServiceLibrary
{
public bool TestSuccess()
{
return true;
}

public bool TestFailure()
{
return false;
}


public class CustomUserNameValidator : UserNamePasswordValidator
{
public override void Validate(String userName, String password)
{
if (null == userName || null == password)
{
throw new SecurityTokenException("Invalid Token");
}

if (!(userName == "user" && password == "password"))
{
throw new SecurityTokenException("Invalid Token");
}
}
}
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Fri Dec 11, 2009 9:07 am