It is possible to have a wcf with basic authentication.
For this the service needs to be configured with a behavior and the enpoint needs a binding configuration.
Example:
Code Block |
---|
<!-- For use with Retail DMA --> <service behaviorConfiguration="BasicAuthServiceBehavior" name="RetailOrderInstructionService"> <endpoint address="" binding="webHttpBinding" contract="Kodi.Kodiak.Services.IRetailOrderInstructionService" behaviorConfiguration="rest" bindingConfiguration="WebHttpsMessageCredentialBinding"/> </service> |
service.Service BehaviorConfiguration serviceBehaviors
Code Block |
---|
<behaviors> <serviceBehaviors> <behavior name="BasicAuthServiceBehavior"> <serviceMetadata httpGetEnabled="false" /> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceCredentials> <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Kodi.Kodiak.Security.BasicUsernamePasswordValidator, Kodi.Kodiak.Security" /> </serviceCredentials> <serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200" maxConcurrentInstances="200" /> <dataContractSerializer maxItemsInObjectGraph="2147483646" /> </behavior> |
...
... |
Endpoint BindingConfiguration
needs to have a transport node with clientCredentialType = “Basic”
Code Block |
---|
<bindings> <webHttpBinding> <binding name="WebHttpsMessageCredentialBinding"> <security mode="Transport"> <transport clientCredentialType="Basic" /> </security> </binding> ... |