WordPress InfoCard integration code

Update:  There are now excellent community-based and commercial implementations of Information Card code for WordPress, php, ruby, “C” and other languages.  I've left this zip here for documentary and pedagogical purposes only.

 I've been wanting to share my experiences adding Information Card support to identityblog for quite a while now.  I just haven't had the time.

I started by publishing my work on building the necessary code for handling secure identity tokens.  But then I got interrupted with the necessities of life – like shipping Cardspace.

Anyway, now I'm ready to present my integration code.  Very little of it is unique to WordPress – it is really code that would in general apply just as much to any other piece of software.  Someone could easily factor my code so the interface is a little cleaner than is currently the case. 

When I had to actually alter wordpress files (only 3 of them), I just show the changes that are necessary.  You'll have to download the original files from wordpress to see what I'm talking about (version 2.0.4) in context (usually not necessary unless you are making the changes in your own version.)

Download my contribution here.  My assumption is that the root of this download is the same as the root of the wordpress directory. 

[WARNING:  DO NOT INSTALL THE WORDPRESS FILES  FROM MY ZIP INTO YOUR OPERATIONAL WORDPRESS DIRECTORY!  IF YOU WANTED TO USE THIS CODE, YOU WOULD NEED TO MANUALLY INTEGRATE THE CHANGES I HAVE MADE TO MY VERSION OF THE WORDPRESS FILES INTO YOUR VERSION OF THE SAME FILES..  THIS NO LONGER MAKES SENSE SINCE THERE ARE EXCELLENT (SUPPORTED!!) VERSIONS AVAILABLE. ]

The files all begin with “infocard” so they're easy to delete if you want to.

I'll be publishing a number of pieces explaining why I took the approaches it did.  I hope this will get some good, concrete conversation going.  The first in this series is uncharacteristically wordpress specific – don't get discouraged if you're looking for something more general.  It talks about how I approached changing the wp-login page.  I'm pretty sure that even people thinking about infocard-enabling other products will find some ideas here that help them out.

Like my previous work, you can use this code in whatever way you want.  My goal is to help as many people as possible understand, use and deploy information cards.

UPDATE:  Thanks to Samuel Rinnetmäki for pointing out the need to warn readers not to install “as is” in an operational directory – it had never occured to me they might do this…  I've edited the  ZIP to make this impossible (09-02-2008).

Published by

Kim Cameron

Work on identity.

3 thoughts on “WordPress InfoCard integration code”

  1. Kim,

    I wanted to share with you that my experience with InfoCard/CardSpaces has been great. The only “bug” I found was not with InfoCard but IE7 RC1.

    When I first visited this site w/o .NET 3.0 installed, IE7 RC1 prompted me to install .NET 3.0 in order to get InfoCard on my system. Awesome. Except, the link apparently directed me to a previous version of .NET 3.0 (I missed capturing what version did get installed). I was able to detect this by visiting the .NET Fx 3.0 sandbox site as I wasn't able to use my self-issued card on their site (mentioned in the FAQ). A side effect of this, also, was that I had to manually install the site certificates into the Trusted People store when visiting an InfoCard enabled site. Uninstalling and installing RC1 of .NET 3.0 solved these problems.

    I'm very much looking forward to the final release of CardSpaces. I am overwhelmed by the applications I see presenting to my employer sees for it.

  2. Hello Kim, thanks for posting your WordPress integration code.
    It appears there is a bug: the code does not accept self-issued
    cards, generated by the Windows CardSpace for Windows XP,
    in which there are Unicode characters present in the given name
    or surname claims which are outside of the US-ASCII “page”. Even
    a value which contains a character from the ISO-8859-1 “page”
    causes the code to fail with “SignedInfo digest (…) doesn't
    match calculated digest (…)”.

    Mark Wahl
    Informed Control Inc.

Comments are closed.