Welcome to Windows CardSpace
Tasks :

Windows CardSpace Team Bloggers

Browse by Tags

All Tags » CardSpace » scripting   (RSS)
Sorry, but there are no more tags available to filter with.

  • Where are the WS-* Protocols? (Part One)

    Logging into a Website

    When signing into a website using CardSpace, the website has the choice of accepting two card types, Personal Cards or Managed Cards.

    Personal Cards are ones that you create the claim values yourself, support only a fixed set of claims, and have the cryptographic keys and PPID generated for you.

    Managed Cards are cards that are issued to you from an Identity Provider, they decide the claims, and they provide the Security Token Server that issues the token to the webiste. We'll cover this one in Part Two.

    Personal Cards and the Protocols

    When a website requests a personal card, it does so by putting an object element into the HTML of the page, and engaging the CardSpace Identity Selector:


    .S0 { font-family: 'Consolas'; color: #000000; background: #FFFFFF; font-size: 9pt; } .S1 { color: #000080; background: #FFFFFF; } .S3 { color: #008080; background: #FFFFFF; } .S5 { color: #007F7F; background: #FFFFFF; } .S6 { color: #7F007F; background: #FFFFFF; } .S8 { color: #800080; background: #FFFFFF; } .S11 { color: #000080; background: #FFFFFF; } .S21 { color: #000080; background: #EFEFFF; } .S22 { font-weight: bold; color: #000080; background: #EFEFFF; } .S23 { color: #006600; background: #EFEFFF; } .S24 { color: #800000; background: #EFEFFF; } span { font-family: 'Consolas'; color: #000000; background: #FFFFFF; font-size: 9pt; } .S40 { color: #7F7F00; background: #FFFFFF; } .S41 { font-weight: bold; font-family: 'Consolas'; color: #000000; background: #F0F0FF; font-size: 9pt; } .S46 { font-family: 'Consolas'; color: #000000; background: #F0F0FF; font-size: 9pt; } .S47 { font-weight: bold; font-family: 'Consolas'; color: #00007F; background: #F0F0FF; font-size: 9pt; } .S48 { font-family: 'Consolas'; color: #7F007F; background: #F0F0FF; font-size: 9pt; } .S50 { font-weight: bold; font-family: 'Consolas'; color: #000000; background: #F0F0FF; font-size: 9pt; } <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
      <title>Sample 4</title>
        <object type="application/x-informationcard" name="_xmlToken">
          <param name="tokenType" value="urn:oasis:names:tc:SAML:1.0:assertion" />
          <param name="issuer"
             value
    ="http://schemas.microsoft.com/ws/2005/05/identity/issuer/self" />
          <param name="requiredClaims"
            value
    ="http://schemas.microsoft.com/ws/2005/05/identity/claims/givenname
                   http://schemas.microsoft.com/ws/2005/05/identity/claims/surname 
                   http://schemas.microsoft.com/ws/2005/05/identity/claims/emailaddress 
                  http://schemas.microsoft.com/ws/2005/05/identity/claims/privatepersonalidentifier"
    />
        </object>
      <script language="javascript">
          function GetIdentity()
          {
            var xmltkn=document.getElementById("_xmltoken");
            var thetextarea = document.getElementById("xmltoken");
            thetextarea.value = xmltkn.value ;
          }
      </script>
    </head>
    <body>
      <form id="form1" method="post" action="login4.aspx">
      <div>
        <button name="go" id="go" onclick="BLOCKED SCRIPTGetIdentity();">
           Click here to get the token.
       
    </button>
        <button type="submit">
          
    Click here to send the card to the server
       
    </button>
        <textarea cols=100 rows=20 id="xmltoken" name="xmlToken" ></textarea>
      </div>
      </form>
        
    </body>
    </html>



    This obviously does not use any WS-* protocols, it's just simply asking the browser to supply the token requested to the website. And, with no STS in the puzzle, where's the WS-*?

    Well, there is an STS. It's built into the CardSpace Identity Selector. It's there to provide the Personal card to the Relying Party (the website). The communication between the Identity Selector and the STS should be WS-* right? Well, since they are tightly coupled in this case, the STS in CardSpace short-circuits some of that and delivers the token to the browser just using inter-process communication. But the STS is built as if it was going to go over a wire, just optimized for local use.

    So, there really isn't WS-* involved here. Until CardSpace supports a Portable STS, which then would seperate the Idenity store from the Idenity Selector, thus requiring WS-*.

    g





    Garrett Serack | Program Manager |Federated Identity Team | Microsoft Corporation
    blog: http://blogs.msdn.com/garretts

  • Detecting Information Card Support (CardSpace!) in a browser

    I hacked out this a few weeks back, and never got around to publishing it.  I've not decided that this is the 'official' way to detect Information Card support in a browser, but it'll do until I can think of something better.

     

    I'd say something like, "see how it detects support in other browsers too?" except that I'm not thinking many people have a CardSpace plugin for another browser yet. But you can trust me--It works!


    <html>

     <head>

       <SCRIPT LANGUAGE="Javascript">

      function AreCardsSupported()

       {

         var IEVer = -1;

         if (navigator.appName == 'Microsoft Internet Explorer')

           if (new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})")

    .exec(navigator.userAgent) != null)

             IEVer = parseFloat( RegExp.$1 );

        

         if( IEVer >= 6 )

         {

           var embed = document.createElement("object");

           embed.setAttribute("type", "application/x-informationcard");

     

           if(  ""+embed.issuerPolicy != "undefined" )

             return true;

           return false;        

          }    

         if( IEVer < 0 && navigator.mimeTypes && navigator.mimeTypes.length)

         {

           x = navigator.mimeTypes['application/x-informationcard'];

           if (x && x.enabledPlugin)

             return true;

         }

         return false;

       }

     

       function ShowDetection()

       {

         if( AreCardsSupported() )

           alert( "Information Cards are supported by this browser :D" );

         else

           alert( "Information Cards are NOT supported by this browser :(" );

       }

     

       </SCRIPT>

       <body onload="ShowDetection()">

      

       </body>

    </head>


     

    g




    Garrett Serack | Program Manager | Connected Identity and Directory| Microsoft Corporation
    blog: http://blogs.msdn.com/garretts 

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us