Subtext 2: OpenID Login Support - Jon Galloway

Subtext 2: OpenID Login Support

The recent Subtext 2 release includes a feature I worked on: OpenID login support. Let’s take a quick look at how you use it, then we’ll talk about the how the code works and why it’s a useful feature.

What’s OpenID?

I’m a big fan of digital identity, and could ramble on about OpenID for a while. But if I did that, this blog post would be published sometime after Windows 7 ships. Fortunately I pushed OpenID on some people who are a bit more prolific than I’ve been of late, so I’ll refer you to this post by Jeff Atwood (CodingHorror) and this webcast by Rob Conery. Scott Hanselman wrote a great overview of OpenID, as well.

The elevator pitch: Rather than being issued an account at every single website you login to, you issue them one. You establish an OpenID URL, which only you can login to, and then you give it as your account information to sites which support OpenID authentication. You’re in control of your account, you’ve got a central place to manage your password, etc.

OpenID is a generic account that you can reuse on other websites.

Too Hard! Couldn’t I Just Fax Someone My Birth Certificate?

If you haven’t used OpenID, this is going to look complex. That’s because I’m showing you the hard case – it’s like learning to play Stairway To Heaven when you don’t have a guitar or amp. The first time through, we’re going to have to run down to the pawn shop to get you a Fender knockoff and a thrasher amp, but the next time you’re ready to rock you’ll be all set. So hang with me while we get setup, and at the end I’ll show you how it will work when you log in to your site tomorrow.

Step 1: Get an OpenID

There’s a good chance you’ve already got an OpenID, since many popular services like Flickr, Yahoo, and Blogger are OpenID providers, meaning that you can user your account with those services as an OpenID identity:

If you don’t have an account with any of those services (or these on the OpenID public providers list), I recommend signing up with MyOpenID.com – they’ve got great support, and rich security features if you want to use them, such as InfoCard integration and phone verification.

Step 2: Tell Subtext What OpenID URL You’ll Be Using

The Security / Options tab has a new location where you can enter an OpenID URL. It’s important that you get this right – we’ll try to clean this up for you, but I recommend you type this as exactly as possible. In my case, my OpenID URL is http://jongalloway.myopenid.com/, not jongalloway.myopenid.com. Even the trailing slash is important.

Note that to in order to make this setting, I’ve logged in to Subtext using my standard Subtext username and password. That login doesn’t go away when I setup OpenID authentication, I’ve just enabled an additional security feature – I’ve got two ways to login to my blog now.

Subtext - Security Options (OpenID)

Step 3: Login Using OpenID

Now that Subtext knows my OpenID URL, I can use it to login to the site. The login dialog includes an OpenID sign-in prompt at the bottom, so I enter my OpenID URL in the prompt and click Login.

Subtext - OpenID Login

Now here’s the part you may not be expecting if you haven’t used OpenID – I need to login at my OpenID provider. That’s not such a big deal, though, because myOpenID (and many other providers) have a “Stay Signed In” option option, which is appropriate if you’re logging in from a computer which is in a secure location (your home, a work computer you keep locked, etc.). The Versisign Seatbelt Firefox Extension is a pretty handy way to sign in to your OpenID identity once for a browser session, too.

Subtext - myOpenID Login

Now, the first time I log in to myOpenID from my Subtext blog, myOpenID is going to ask me if that’s cool. Again, a little unexpected if you haven’t used OpenID before, but this is a one time thing. We’re telling myOpenID that my Subtext blog is going

Subtext - myOpenID Verification

So, I type in my password and click the Sign Button, and my OpenID provider redirects me back to my Subtext instance (with an “authenticated” message), and Subtext logs me in:

Subtext - Admin

Fine. Now Show Me Easy.

Thanks for hanging in there. Here’s how it looks tomorrow, providing you’ve checked that “Stay Signed In” checkbox. First, we browse to the login screen, enter our OpenID URL, and click Login:

Subtext - OpenID Login

Now, we’re automatically logged in and brought to our admin screen:

Subtext - Admin

If you hadn’t checked that Stay Signed On checkbox, you’d get one screen in the middle – the login page for your OpenID provider’s page.

How’s It Work?

That’s the subject of another post, but let me show you one quick screenshot which shows the HTTP traffic during that last login.

Subtext - OpenID trace (Fiddler)

That shows the general sequence of events:

  1. I requested the Login page (it’s running on my local machine – 127.0.0.1)
  2. The DotNetOpenID login control makes a request to the URL I provided, saying “Yo. My URL is 127.0.0.1:2732, can you authenticate the user and verify that I’m on their list of sites?”
  3. There’s a little negotiation between the two sites, after which myOpenID returns an “Okay” message via SSL.

Show Us Your Code

Sure. For this release, I just used the DotNetOpenID.OpenIdLogin control, which is as simple as dropping the control on the page and handling the LoggedIn event. Scott Hanselman wrote about this before when he set up OpenID on DasBlog. In the case of Subtext, here’s the code I added for that LoggedIn event:

protected void btnOpenIdLogin_LoggedIn(object sender, OpenIdEventArgs e)
 {
   e.Cancel = true; //required to prevent logging everyone in
   if (e.Response.Status == AuthenticationStatus.Authenticated &&
       SecurityHelper.Authenticate(e.ClaimedIdentifier, chkRememberMe.Checked))
    {
         ReturnToUrl(Config.CurrentBlog.AdminHomeVirtualUrl);
    }
} 

You can see it in context in the Subtext SVN browser. Now that I’ve worked with it, I’d like to ditch the OpenIdLogin control for a future release. It works just fine, but it generates HTML that I’m not very happy with (table based markup, not CSS friendly). In the future, I’d probably write my own control and just use the libraries which are included in DotNetOpenID – they’ve been great.

OpenID Passthrough

There’s another new OpenID feature in Subtext 2.0 – OpenID Passthrough. The idea there is that you can use your blog URL as your OpenID URL, and it just redirects over to your “real” OpenID provider. Let’s assume that my blog was deployed to http://jongalloway.com; in that case I could make the following OpenID Passthrough settings on the Subtext / Configure screen, after which I could use http://jongalloway.com as my OpenID URL.

Subtext - OpenID Passthrough

Published Wednesday, August 20, 2008 10:41 PM by Jon Galloway

Comments

# re: Subtext 2: OpenID Login Support

Jon,

Great post.  Before you write your own control to replace the OpenIdLogin control though, have you looked at the OpenIdTextBox control?  It is more streamlined and doesn't use tables.  It might save you some time.

Thursday, August 21, 2008 3:06 PM by aarnott

# Subtext 2 supports OpenID

You've been kicked (a good thing) - Trackback from DotNetKicks.com

Thursday, August 21, 2008 5:22 PM by DotNetKicks.com

# re: Subtext 2: OpenID Login Support

@aarnott - Thanks, I hadn't seen that! Thanks again for all your work on DotNetOpenID.

Friday, August 22, 2008 1:47 AM by Jon Galloway

# re: Subtext 2: OpenID Login Support

You're welcome, Jon!  I'm just glad to see it used. :)

Also, check out nerdbank.org/.../ajaxlogin.aspx, which is a prototype OpenIdAjaxTextBox that I'm building for a future version of DotNetOpenId especially for blogs.

Saturday, August 23, 2008 1:53 PM by aarnott

# Our little team is growing - Welcome to Jon Galloway and Pete Brown

Just about two years ago I joined Microsoft . I'm fortunate to work in a home office with a great team

Thursday, November 12, 2009 5:49 PM by ASPInsiders

# Our little team is growing – Welcome to Jon Galloway and Pete Brown | CHARGED's Digital Lifestyle at Work or Play

Pingback from  Our little team is growing – Welcome to Jon Galloway and Pete Brown | CHARGED's Digital Lifestyle at Work or Play

# re: Subtext 2: OpenID Login Support

Found this article interesting.I have to look forward to read more from your site in the future..

Thursday, February 04, 2010 8:06 PM by sikat ang pinoy

# re: Subtext 2: OpenID Login Support

asp.net and subtext is same blogging platform. Also blogengine powered by asp.net.

Saturday, February 06, 2010 12:40 AM by renantech

# re: Subtext 2: OpenID Login Support

Cool article as for me. It would be great to read a bit more about this theme. The only thing that blog misses is some pics of any gadgets.

Kate Kripke

<a href="www.jammer-store.com/">radio jammers for sale</a>

Friday, July 09, 2010 12:06 PM by BlogSearcher

# re: Subtext 2: OpenID Login Support

Don't stop posting such stories. I like to read blogs like that. BTW add some pics :)

Friday, September 03, 2010 8:43 AM by escort and genf

# re: Subtext 2: OpenID Login Support

It is certainly interesting for me to read that blog. Thanks for it. I like such themes and everything that is connected to this matter. I definitely want to read a bit more soon.

Avril Swenson

<a href="irelandescortdirectory.com/.../dublin-escorts">escorts dublin ireland</a>

Sunday, October 03, 2010 2:37 AM by Avril Swenson

# re: Subtext 2: OpenID Login Support

Thanks for sharing the information. This truly made for a fascinating read. I'll be sure to keep up with your next posts, thanks.

Wednesday, October 06, 2010 5:22 AM by Essays

# re: Subtext 2: OpenID Login Support

My English conversation is not so super butI assume I comprehend everything. Say thanks to u a lot for that wonderful webpage publish. I really get pleasure from perusing it. I believe you  are a absolute author. At this second added ur website to my favorites and will arrive once more to yor world-wide-web webpage. Hold up that wonder give good results. Desire to determine  more shortly.

--------------------------------------------

my website is  

http://polarwatches.info

Also welcome you!

Wednesday, November 17, 2010 4:59 AM by Korean Phrases

# re: Subtext 2: OpenID Login Support

Fantastic information and great story. Very happy to read about!

Monday, December 06, 2010 9:50 AM by essays

# re: Subtext 2: OpenID Login Support

I really like this website , and hope you will write more ,thanks a lot for your information.

http://www.belowbulk.com

Monday, December 27, 2010 8:59 PM by designer wholesale

# re: Subtext 2: OpenID Login Support

I really like this website , and hope you will write more ,thanks a lot for your information.

http://www.belowbulk.com

Monday, December 27, 2010 9:09 PM by designer wholesale

# re: Subtext 2: OpenID Login Support

It is my pleasure to read this page,I look forward to reading more.

http://www.belowbulk.com

Monday, December 27, 2010 9:16 PM by cheap clothes

# re: Subtext 2: OpenID Login Support

-----------------------------------------------------------

"sometimes people here the words world-wide-web marketing and so they think, yahoo and google or facebook or myspace, but there's a lot of other procedures to basically industry  a website or company and get your way up there like myspace did."

Monday, January 03, 2011 7:18 PM by ipad app reviews

# re: Subtext 2: OpenID Login Support

Optimists always picture themselves accomplishing their goals.

Thursday, January 06, 2011 2:35 AM by mybeads@chongseo.com

# re: Subtext 2: OpenID Login Support

-----------------------------------------------------------

good good…this publish deserves absolutely nothing …hahaha just joking :P …wonderful submit :P

Saturday, January 08, 2011 5:03 PM by ipad accessories

# re: Subtext 2: OpenID Login Support

I enjoyed this post Abhishek. It was certainly creative and not what I was expecting when I clicked on the title – a title I might add, which is quite good. I know I had to find out what ways ‘guaranteed’ I could grow my list.

Monday, January 24, 2011 11:26 PM by DC Hats

# re: Subtext 2: OpenID Login Support

This is really nice and secure for students. A advanced technique for students.

Tuesday, February 01, 2011 2:56 PM by Latest Gadget News

# re: Subtext 2: OpenID Login Support

It really helps me to complete my project and the technique is interested for beginners as well.

Tuesday, February 15, 2011 7:45 AM by AIT 2 Tape

# re: Subtext 2: OpenID Login Support

It is extremely interesting for me to read that blog. Thanks for it. I like such themes and everything connected to this matter. I definitely want to read a bit more on that blog soon.

Kate Smith    

<a href="milanescorts.com/">susanna rio annuncio girl escort milano</a>

Wednesday, March 09, 2011 4:50 PM by Kate Smith

# re: Subtext 2: OpenID Login Support

I downloaded the file, but instead of being a .csh file it’s a .zip file. Is there a way or certain program that I need to open it up?

Monday, March 28, 2011 5:05 AM by Online CPR Certification

# re: Subtext 2: OpenID Login Support

Hi, thanks you for creating the trouble to debate this particular, I feel strongly about this and like studying a great deal more with this topic. If possible, as you acquire expertise, would you intellect updating your webpage with a great deal more particulars? It's honestly favourable targeted me.

Friday, April 01, 2011 4:05 AM by emmajrmillersberg@gmail.com

# re: Subtext 2: OpenID Login Support

Thanks for the detailed instructions, this info was very helpful for me

Wednesday, April 13, 2011 9:01 AM by thesis writing service

# re: Subtext 2: OpenID Login Support

I enjoy your writing style genuinely loving this internet site. “Do not speak quickly it is a sign of insanity.” by Bias.

Wednesday, January 18, 2012 5:08 AM by Dissertation service

# re: Subtext 2: OpenID Login Support

Wednesday, January 18, 2012 8:06 AM by pchudjhp

# re: Subtext 2: OpenID Login Support

Very great post! Thanks for sharing the information,i appreciate your blog site and bookmarked it.

Monday, January 23, 2012 1:51 AM by lilash

# re: Subtext 2: OpenID Login Support

I want studying and I conceive this website got some genuinely utilitarian stuff on it!

Tuesday, January 24, 2012 1:15 AM by carpet cleaning carlton

# re: Subtext 2: OpenID Login Support

Terrific post however I was wanting to know if you could write a litte more on this subject? I'd be very thankful if you could elaborate a little bit more. Appreciate it!

Tuesday, January 24, 2012 4:32 AM by Wireless broadband australia

# re: Subtext 2: OpenID Login Support

Thanks for this informative post. It help me a lot. And it gave mo ideas on how to make more money in marketing business. I hope lots of people visit this site so they can easily learn this informative post.

Sunday, January 29, 2012 5:30 AM by term papers

# re: Subtext 2: OpenID Login Support

Today when i wakeup i feel very lazy due to browsing last whole day but now i feel happy because my searching comes to end after reading your article.

Tuesday, January 31, 2012 4:53 AM by Resume writing services review

# re: Subtext 2: OpenID Login Support

Nice blog here! Also your website loads up fast! What host are you using? I wish my website loaded up as fast as yours lol

Wednesday, February 01, 2012 2:20 AM by How to get Rid of Allergies

# re: Subtext 2: OpenID Login Support

Valuable information. Lucky me I found your site by accident, and I am shocked why this accident did not happened earlier! I bookmarked it

Saturday, February 04, 2012 1:21 AM by sunshine coast accommodation

# re: Subtext 2: OpenID Login Support

I like the helpful information you provide in your articles. I will bookmark your blog and check again here frequently. I'm quite sure I will learn a lot of new stuff right here! Best of luck for the next!

Saturday, February 04, 2012 5:52 AM by gold coast accommodation

# re: Subtext 2: OpenID Login Support

This information is excellent, as share good stuff with good concept.

Monday, February 06, 2012 7:16 AM by Airlie Beach Accommodation

# re: Subtext 2: OpenID Login Support

I really love to read articles that have good information and ideas to share to each reader. I hope to read more from you guys and continue that good work that is really inspiring to us.

Monday, February 06, 2012 7:18 PM by Blind Brokers Network

# re: Subtext 2: OpenID Login Support

I have read your article and It was really very excellent  to understand and very useful for other reader who intrested on this topic. its very nice.

Wednesday, February 08, 2012 8:27 AM by albert.ray87@gmail.com

# re: Subtext 2: OpenID Login Support

This design is wicked! You most certainly know how to keep a reader amused. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job. I really loved what you had to say, and more than that, how you presented it. Too cool!

Thursday, February 09, 2012 3:07 AM by sawanpareek

# re: Subtext 2: OpenID Login Support

Great blog! The information you provide is quiet helpful, why I was not able to find it earlier. Anyways I’ve subscribed to your feeds, keep the good work up.

Friday, February 10, 2012 6:17 AM by port douglas cheap accommodation

# re: Subtext 2: OpenID Login Support

This article gives the light in which we can observe the reality. i realy thanks for this article because its very nice and new experience learn from it.

Friday, February 10, 2012 7:10 AM by fine lingerie

Leave a Comment

(required) 
(required) 
(optional)
(required)