C# 使用WIF创建SAML身份验证请求

C# 使用WIF创建SAML身份验证请求,c#,.net,saml,wif,federated-identity,C#,.net,Saml,Wif,Federated Identity,似乎大部分WIF信息对于跨整个应用程序启用联合身份验证非常有用。我对使用API创建SAML身份验证请求和接收/解释SAML响应感兴趣 我在上找到了下面的帖子,这让我在接收和解释SAML响应方面走上了正确的方向。有人能给我更多关于如何使用API创建SAML请求的信息吗 关于API的更多信息(阅读材料、视频等)将非常感谢。 < P>因为没有其他人回答,这里有一篇文章,来自Michelle Bustamante: 下面是一个小示例,其中一个表单演示了如何通过编程方式创建对STS的(SAML)安全令牌请

似乎大部分WIF信息对于跨整个应用程序启用联合身份验证非常有用。我对使用API创建SAML身份验证请求和接收/解释SAML响应感兴趣

我在上找到了下面的帖子,这让我在接收和解释SAML响应方面走上了正确的方向。有人能给我更多关于如何使用API创建SAML请求的信息吗


关于API的更多信息(阅读材料、视频等)将非常感谢。

< P>因为没有其他人回答,这里有一篇文章,来自Michelle Bustamante:


下面是一个小示例,其中一个表单演示了如何通过编程方式创建对STS的(SAML)安全令牌请求:

private static SecurityToken GetSamlToken(string realm, string stsEndpoint, ClientCredentials clientCredentials)
    {
        using (var factory = new WSTrustChannelFactory(
            new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential), 
            new EndpointAddress(new Uri(stsEndpoint))))
        {
            factory.Credentials.UserName.UserName = clientCredentials.UserName.UserName;
            factory.Credentials.UserName.Password = clientCredentials.UserName.Password;
            factory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
            factory.TrustVersion = TrustVersion.WSTrust13;

            WSTrustChannel channel = null;

            try
            {
                var rst = new RequestSecurityToken
                              {
                                  RequestType = WSTrust13Constants.RequestTypes.Issue, 
                                  AppliesTo = new EndpointAddress(realm), 
                                  KeyType = KeyTypes.Bearer, 
                              };

                channel = (WSTrustChannel)factory.CreateChannel();

                return channel.Issue(rst);
            }
            finally
            {
                if (channel != null)
                {
                    channel.Abort();
                }

                factory.Abort();
            }
        }

这是一个巨大的帮助。谢谢,尤金尼奥。我不相信这会产生一个SAML
AuthnRequest
。它似乎创建了WSTrust
RequestSecurityToken