danze
danze

Reputation: 765

Convert a SAML 2.0 xml element token to a .NET System.IdentityModel.Tokens.SecurityToken

I have a SAML 2.0 bearer token that I acquired using a third party library from our SSO server. Now I'm trying to use this token to authenticate against a soution. The problem I'm having is my token is of type XmlElement and I need to convert it to System.IdentityModel.Tokens.SecurityToken type because ChannelFactory.CreateChannelWithIssuedToken expects a SecurityToken type. Any ideas?

BTW I have seen this post How to convert SAML XML token string to either SecurityToken or ClaimsPrincipal instance? but it doesn't help.

Upvotes: 0

Views: 1726

Answers (1)

leastprivilege
leastprivilege

Reputation: 18482

To be exact - for that method you need to convert it to a GenericXmlSecurityToken - just use the ctor (you can ignore aka null most other parameters).

Upvotes: 1

Related Questions