Hello, I don't think you really read my message.
Atsushi Eno (2011/02/17 0:36), rjhdakota wrote: > I am having what I believe is the same problem. You say basic authentication > is working, any examples? Our project needs the ability to authorize a > connection, and currently we cannot. Here is the code that works on Windows > but allows anyone to connect on MONO: > > Public Sub WCFStartService() > ' http service, one-way > > Dim binding = New > BasicHttpBinding(System.ServiceModel.BasicHttpSecurityMode.TransportCredentialOnly) > binding.Security.Transport.ClientCredentialType = > HttpClientCredentialType.Basic > > Dim address = New Uri("http://192.168.1.129:8080") > ServiceHost = New ServiceHost(GetType(HelloService)) > > > ServiceHost.Credentials.UserNameAuthentication.UserNamePasswordValidationMode > = Security.UserNamePasswordValidationMode.Custom > > ServiceHost.Credentials.UserNameAuthentication.CustomUserNamePasswordValidator > = New CustomUserNameValidator > > ServiceHost.AddServiceEndpoint(GetType(IHelloService), binding, > address) > ServiceHost.Open() > End Sub > > Public Class CustomUserNameValidator > Inherits IdentityModel.Selectors.UserNamePasswordValidator > > Public Overrides Sub Validate(ByVal userName As String, ByVal > password As String) > If Nothing = userName OrElse Nothing = password Then > Throw New ArgumentNullException() > End If > > If Not (userName = "user" AndAlso password = "pass") Then > ' This throws an informative fault to the client. > Throw New FaultException("Unknown Username or Incorrect > Password") > ' When you do not want to throw an infomative fault to the > client, > ' throw the following exception. > ' Throw New SecurityTokenException("Unknown Username or > Incorrect Password") > End If > > End Sub > > > End Class _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list