我需要检查特定用户是否存在于 Active Directory 中ADFS
.
所以,我想要我的ADFS to check user Authentication
通过用户名/密码。
任何人都可以提供示例代码或教程吗?
提前致谢!
要使用用户名/密码身份验证,您可以使用
信任/13/用户名混合
ADFS 2.0 的端点。
这不会检查用户是否存在于 Active Directory 中!
在代码中,您像这样请求令牌:
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);
然后使用您的令牌为您的服务创建通道工厂:
var binding = new WS2007FederationHttpBinding(WSFederationHttpSecurityMode.Message);
var factory = new ChannelFactory<IYourInterface >(binding, "your service address");
factory.ConfigureChannelFactory();
IYourInterface channel = factory.CreateChannelWithIssuedToken(token);
希望这可以帮助!
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)