I realized that there were many gotachs when running the sample STS that is posted here. This has evolved and the experience is really improved. Thanks to Garrett.
Some steps
Code Pointers for Managed Cards
There was a failure making a WS-Trust exchange with an external application. Could not retrieve token from identity provider.
Inner Exception: An error occurred while receiving the HTTP response to http://www.fabrikam.com:7000/sample/trust/selfissuedsaml/sts. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.Inner Exception: The underlying connection was closed: An unexpected error occurred on a receive.Inner Exception: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.Inner Exception: An existing connection was forcibly closed by the remote host When you make a cardspace site make sure you are accessing over SSL or you get script access denied.
protected List<SamlAttribute> GetTokenAttributes() {
try
{
System.Diagnostics.Debug.WriteLine("GetTokenAttributes -- Started");
List<SamlAttribute> result = new List<SamlAttribute>();
//result.Add(new SamlAttribute(new Claim(ClaimTypes.PPID , "*Fill in this field*", Rights.PossessProperty)));
List<Claim> claims = IdentityManager.GetCurrentRequestUserClaims();
foreach (Claim claim in claims)
result.Add(new SamlAttribute(claim));
}
return result;
finally
System.Diagnostics.Debug.WriteLine("GetTokenAttributes -- Ended");
byte[] decryptedData = decryptToken(xmlToken);
XmlReader reader = new XmlTextReader(new StreamReader(new MemoryStream(decryptedData), Encoding.UTF8));
m_token = (SamlSecurityToken)WSSecurityTokenSerializer.DefaultInstance.ReadToken(reader, null);
SamlSecurityTokenAuthenticator authenticator = new SamlSecurityTokenAuthenticator(new List<SecurityTokenAuthenticator>(
new SecurityTokenAuthenticator[]{
new RsaSecurityTokenAuthenticator(),
new X509SecurityTokenAuthenticator(X509CertificateValidator.None) }), MaximumTokenSkew);
if (authenticator.CanValidateToken(m_token))
ReadOnlyCollection<IAuthorizationPolicy> policies = authenticator.ValidateToken(m_token);
m_authorizationContext = AuthorizationContext.CreateDefaultAuthorizationContext(policies);
FindIdentityClaims();
else
throw new Exception("Unable to validate the token.");
I hope after all these steps you are a step closer to the managed card STS sample.