To use Username / Password authentication, you can use
trust / 13 / UsernameMixed
ADFS 2.0 endpoint
This does NOT check if the user exists in Active Directory!
In the code, you request a token as follows:
WSTrustChannelFactory adfsfactory = new WSTrustChannelFactory(new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential), StsEndpoint); adfsfactory.TrustVersion = TrustVersion.WSTrust13; // Username and Password here... factory.Credentials.UserName.UserName = "domain\username"; factory.Credentials.UserName.Password = "password"; IWSTrustChannelContract channel = adfsfactory.CreateChannel(); // request the token SecurityToken token = channel.Issue(rst);
Then create a factory channel for your service using your token:
var binding = new WS2007FederationHttpBinding(WSFederationHttpSecurityMode.Message); var factory = new ChannelFactory<IYourInterface >(binding, "your service address"); factory.ConfigureChannelFactory(); IYourInterface channel = factory.CreateChannelWithIssuedToken(token);
Hope this helps!
source share