简体   繁体   English

使用 Web 服务在 ADFS 中进行身份验证

[英]Authentication in ADFS with Web Service

I have developed the test application in which I have added .asmx file for ADFS authentication, after authentication, it would redirect to my original already developed web application.我开发了测试应用程序,其中添加了用于 ADFS 身份验证的 .asmx 文件,身份验证后,它将重定向到我原来已经开发的 Web 应用程序。 the common code is shown below通用代码如下所示

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;
    ...
}
...

The line var token = channel.Issue(rst);var token = channel.Issue(rst); throws error抛出错误

Error is ID3082: The request scope is not valid or is unsupported

Also, I am not sure which URI I should use for RelyingPartyURI另外,我不确定应该为 RelyingPartyURI 使用哪个 URI

  • the service URL which I am using for ADFS authentication.我用于 ADFS 身份验证的服务 URL。 or
  • the URL of my already developed web application我已经开发的 Web 应用程序的 URL

Please help.请帮忙。

relayPartyUri 是您的应用程序的唯一标识符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM