Author: atsushi
Date: 2007-04-04 14:30:07 -0400 (Wed, 04 Apr 2007)
New Revision: 75402

Modified:
   trunk/olive/samples/services/cardspace/ChangeLog
   trunk/olive/samples/services/cardspace/gettoken.cs
Log:
2007-04-04  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * gettoken.cs : now it works on .NET;
          IssuedSecurityTokenParameters.CreateRequestParameters() showed the
          expected form of parameters xml.



Modified: trunk/olive/samples/services/cardspace/ChangeLog
===================================================================
--- trunk/olive/samples/services/cardspace/ChangeLog    2007-04-04 18:25:05 UTC 
(rev 75401)
+++ trunk/olive/samples/services/cardspace/ChangeLog    2007-04-04 18:30:07 UTC 
(rev 75402)
@@ -1,5 +1,11 @@
 2007-04-04  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * gettoken.cs : now it works on .NET;
+         IssuedSecurityTokenParameters.CreateRequestParameters() showed the
+         expected form of parameters xml.
+
+2007-04-04  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * manage.cs, import.cs, gettoken.cs, test.cer : initial checkin.
          gettoken.exe is still not working yet ...
 

Modified: trunk/olive/samples/services/cardspace/gettoken.cs
===================================================================
--- trunk/olive/samples/services/cardspace/gettoken.cs  2007-04-04 18:25:05 UTC 
(rev 75401)
+++ trunk/olive/samples/services/cardspace/gettoken.cs  2007-04-04 18:30:07 UTC 
(rev 75402)
@@ -3,6 +3,7 @@
 using System.Collections.ObjectModel;
 using System.IdentityModel.Claims;
 using System.IdentityModel.Selectors;
+using System.IdentityModel.Tokens;
 using System.Security.Cryptography.X509Certificates;
 using System.ServiceModel;
 using System.ServiceModel.Channels;
@@ -12,7 +13,13 @@
 
 public class Test
 {
-       public static void Main ()
+       // This sample requires managed card.
+       // You can get one from e.g. http://itickr.com/index.php/?p=41
+
+       // usage: gettoken.exe issuerURI issuerCertificate
+       // example:
+       // gettoken.exe https://infocard.pingidentity.com/idpdemo/sts ping.cer
+       public static void Main (string [] args)
        {
                XmlDocument doc = new XmlDocument ();
                doc.AppendChild (doc.CreateElement ("root"));
@@ -24,8 +31,8 @@
                }
                XmlElement endpoint = doc.DocumentElement.FirstChild as 
XmlElement;
                using (XmlWriter w = doc.DocumentElement.CreateNavigator 
().AppendChild ()) {
-                       new EndpointAddress (new Uri ("http://localhost:9090";),
-                               new X509CertificateEndpointIdentity (cert))
+                       new EndpointAddress (new Uri (args [0]),
+                               new X509CertificateEndpointIdentity (new 
X509Certificate2 (args [1])))
                                .WriteTo (AddressingVersion.WSAddressing10, w);
 
                }
@@ -33,10 +40,18 @@
                string infocard = 
"http://schemas.xmlsoap.org/ws/2005/05/identity";;
                XmlElement p = doc.CreateElement ("Claims", wst);
                p.SetAttribute ("Dialect", ClaimTypes.Name);
-               p.AppendChild (doc.CreateElement ("Name", infocard));
+               XmlElement ct = doc.CreateElement ("ClaimType", infocard);
+               ct.SetAttribute ("Uri", ClaimTypes.Email);
+               p.AppendChild (ct);
                XmlElement issuer = doc.DocumentElement.LastChild as XmlElement;
-               CardSpaceSelector.GetToken (endpoint, new XmlElement [] 
{p.FirstChild as XmlElement},
-                       issuer, WSSecurityTokenSerializer.DefaultInstance);
+               GenericXmlSecurityToken token = CardSpaceSelector.GetToken (
+                       endpoint, new XmlElement [] {p}, issuer, 
WSSecurityTokenSerializer.DefaultInstance);
+               XmlWriterSettings s = new XmlWriterSettings ();
+               s.Indent = true;
+               using (XmlWriter xw = XmlWriter.Create (Console.Out, s)) {
+                       WSSecurityTokenSerializer.DefaultInstance.WriteToken (
+                               xw, token);
+               }
        }
 }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to