[英]wcf service call with webhttpbinding not working when calling from web application when using adfs 2.0 passive authentication
[英]Authentication in ADFS with Web Service
我开发了测试应用程序,其中添加了用于 ADFS 身份验证的 .asmx 文件,身份验证后,它将重定向到我原来已经开发的 Web 应用程序。 通用代码如下所示
var stsEndpoint = ConfigurationManager.AppSettings["EndPoint"];
var relayPartyUri = ConfigurationManager.AppSettings["RelayPartyUri"];
EndpointAddress epoint = new EndpointAddress(stsEndpoint);
using (var factory = new WSTrustChannelFactory(new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential), epoint) { TrustVersion = TrustVersion.WSTrust13 })
{
if (factory.Credentials != null)
{
factory.Credentials.UserName.UserName = @"Domain\" + userName;
factory.Credentials.UserName.Password = password;
}
var rst = new RequestSecurityToken
{
RequestType = WSTrust13Constants.RequestTypes.Issue,
AppliesTo = new EndpointReference(relayPartyUri),
KeyType = WSTrust13Constants.KeyTypes.Bearer
};
var channel = factory.CreateChannel();
var token = channel.Issue(rst);
var genericToken = token as GenericXmlSecurityToken;
...
}
...
行var token = channel.Issue(rst); 抛出错误
Error is ID3082: The request scope is not valid or is unsupported
另外,我不确定应该为 RelyingPartyURI 使用哪个 URI
请帮忙。
relayPartyUri 是您的应用程序的唯一标识符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.