title: Error while deserializing SAML2 response to Saml2SecurityToken
body: <p>I have a SAML Reponse which I want to convert to a Saml2SecurityToken.
  This is what I do:</p>
  
  <pre><code>// SAMLResponseString is a base64 encode SAML2 XML string
  string SAMLResponse = SamlHelper.DecodeFrom64(SAMLResponseString);
  XmlReader reader = new XmlTextReader(new StringReader(SAMLResponse));
  
  var certificate = new X509Certificate2("[path]", "[password]");
  List&lt;SecurityToken&gt; tokens = new List&lt;SecurityToken&gt;();
  tokens.Add(new X509SecurityToken(certificate));
  
  SecurityTokenResolver outOfBandTokenResolver =
    SecurityTokenResolver.CreateDefaultSecurityTokenResolver(new 
    ReadOnlyCollection&lt;SecurityToken&gt;(tokens), true);
  var securityToken = (Saml2SecurityToken) WSSecurityTokenSerializer.DefaultInstance.ReadToken(reader, null);
  </code></pre>
  
  <p>On the last line (of the WSSecurityTokenSerializer), I get the following error:</p>
  
  <pre><code>Cannot read the token from the 'Response' element with the 'urn:oasis:names:tc:SAML:2.0:protocol' namespace for BinarySecretSecurityToken, with a '' ValueType. If this element is expected to be valid, ensure that security is configured to consume tokens with the name, namespace and value type specified.
  </code></pre>
  
  <p>My Response is starting with: (without the space between &lt; and samlp:Response):</p>
  
  <pre><code>&lt; samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0"&gt;
  </code></pre>
  
  <p>Does anyone know what is going wrong here?</p>