我需要通过ADFS检查特定用户是否存在于Active中。
因此,我希望我的ADFS通过用户名/密码进行check user Authentication。
请任何人提供相同的示例代码或教程。
提前感谢!
发布于 2012-05-23 09:55:41
若要使用用户名/密码身份验证,可以使用
信任/13/UsernameMixed
ADFS2.0的端点。
这不检查用户是否存在于中!
在代码中,您请求的令牌如下所示:
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);希望这能有所帮助!
发布于 2012-05-18 19:48:35
ADFS2.0登录页支持开箱即用的用户名/密码身份验证。不需要代码或自定义。
发布于 2012-05-20 19:15:58
按照per @Marnix的说法,这是一种不受欢迎的行为。
不过,我只想指出:
对用户进行身份验证与检查Active Directory中是否存在特定用户是不一样的。
用户可能被锁在门外。他仍然存在于AD中,但将无法验证。
https://stackoverflow.com/questions/10651304
复制相似问题