Ruby and OpenID

Brian Ellin

JanRain, Inc.



Slides and code: http://openidenabled.com/resources/pdx.rb/

What is OpenID?

History

Terminology

OpenID URL
Also called an identity URL, this is the URL owned by the end user or provided by her identity server.
End User
The human who wants to prove their identity to another site.
OpenID Consumer
The website that wants to consume the end user's identity. This site wants the user to prove that they actually own the provided OpenID url through a conversation with their OpenID server. Also called a relying party.

Terminology continued

OpenID Server
The URL the end user declares to have authority over their identity. The consumer asks the server for cryptographic proof that they own the OpenID URL provided.
User Agent
End user's web browser.

OpenID Design Goals

OpenID Protocol Overview

  1. User submits Identity URL on a consumer site
  2. Consumer fetches the content of the provided identity URL, and extracts server infomation
  3. Consumer creates an association with server (or uses an existing one). Shared secret is exchanges using Diffie-Hellman.
  4. Consumer sends HTTP 302 redirect to server with the user's identiy information through the user agent.
  5. End user authenticates with server, and authorizes the consumer's use of their identity. May be skipped if user is already logged into server and has previously approved consumer.
  6. Server redirects back to consumer and verifies the user's authentication using the server association.

Protocol Diagram

Dumb Mode

Role of the OpenID Server

An OpenID server does several important things: Also

Getting an OpenID



These sites provide you with a URL that you own. The HTML on the end of that URL will contain the server discovery snippet:


<link rel="openid.server" href="http://example.com/server">

Delegation: Using your Own URL

You may use a URL that you own but is not on your OpenID server
  • I use MyOpenID.com as my server and own http://brian.myopenid.com/
  • I also own http://brianellin.com/, and would like to use it as my identity.
  • I don't want to run my own server.
  • I add the following to brianellin.com/index.html


<head>
<link rel="openid.server" href="http://www.myopenid.com/server">
<link rel="openid.delegate" href="http://brian.myopenid.com/">
</head>

Existing OpenID Consumers

You may use your identity at the following sites:

SSO and Identity Centric Apps

Ruby Library

Writing a Consumer

Framework requirements:

OpenIDConsumer Interface

OpenIDConsumer continued

  • complete_auth(token, params)
    • Takes token which you stored after begin_auth
    • params is a Hash-like object of the GET arguments to this request
    • Returns an array of two describing the authenticaion results.
    • OpenID::SUCCESS !
  • Instiki Example

    Instiki is a wiki written with Ruby on Rails, and comes with a feature to password protect wiki webs. The approach it takes could be better:
    Extending Instiki to use a whitelist of OpenID URLs:

    Instiki Demo

    Running at http://openidenabled.com:2500/

    Download the code at the URL below.

    Building on the Identity Foundation

    It is incremental!

    Starting with a indentity foundation like OpenID, we can build a solid stack that will make the web 2.0 really useful:

    Further Reading

    Learn more at:

    Thanks!

    Questions, comments, ideas?

    brian -at- janrain -dot- com