I would like to obtain SAML 2.0 token by using SAML 2.0 protocol instead of WSTrust. ADFS 3.0 is used. Are there any nuget packages or other libraries that can achieve that?
Current code is using WSTrust and KERBEROS:
WSTrustChannelFactory trustChannelFactory = null;
var bindingElementCollection = new BindingElementCollection();
bindingElementCollection.Add(SecurityBindingElement.CreateKerberosOverTransportBindingElement());
trustChannelFactory = new WSTrustChannelFactory
(
new CustomBinding(bindingElementCollection),
new EndpointAddress(kerberosmixedendpoint)
);
trustChannelFactory.Credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
trustChannelFactory.TrustVersion = TrustVersion.WSTrust13;
var requestSecurityToken = new RequestSecurityToken
{
RequestType = RequestTypes.Issue,
AppliesTo = new EndpointReference(Url),
KeyType = KeyTypes.Bearer,
};
var channel = (WSTrustChannel)trustChannelFactory.CreateChannel();
var securityToken = await Task<GenericXmlSecurityToken>.Factory.FromAsync(
channel.BeginIssue, ar =>
{
GenericXmlSecurityToken token = null;
try
{
token = channel.EndIssue(ar, out RequestSecurityTokenResponse response)
as GenericXmlSecurityToken;
}
catch (Exception ex)
{
}
return token as GenericXmlSecurityToken;
},
requestSecurityToken,
null
);
result = securityToken?.TokenXml?.OuterXml;
so I need to get smth like this securityToken?.TokenXml?.OuterXml but using SAMLP protocol. I cannot use WIF since it does not support SAML 2.0 protocol.