The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Digest Authorization support

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Robertson

Posts: 29924
Nickname: jarober61
Registered: Jun, 2003

David Buck, Smalltalker at large
Digest Authorization support Posted: Mar 15, 2004 8:17 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by James Robertson.
Original Post: Digest Authorization support
Feed Title: Cincom Smalltalk Blog - Smalltalk with Rants
Feed URL: http://www.cincomsmalltalk.com/rssBlog/rssBlogView.xml
Feed Description: James Robertson comments on Cincom Smalltalk, the Smalltalk development community, and IT trends and issues in general.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by James Robertson
Latest Posts From Cincom Smalltalk Blog - Smalltalk with Rants

Advertisement

I've just added digest authorization support to BottomFeeder - this allows users to deal with protected feeds on LiveJournal. Grab the Http-Access update from the server, and you should be all set.

Adding this was made easier by Smalltalk. The basic Http libraries in VisualWorks do not handle digest authorization. All the support for Basic auth was in, but not for digest. Fortunately, I can extend those libraries in Smalltalk. Sure, it would have been simpler yet had the support been in the libraries, but face it - no matter what vendor and language you pick, you aren't going to find support for everything. VW supports most of what I needed in Http, and it was a fairly simple matter to extend the support to digest

The hardest part for me was reading the spec and following it - I'm not normally dealing with IETF specs, and I'm more of an application level developer than I am a framework/library developer. Fortunately, all of the code necessary to produce an md5 hash are already in VisualWorks - the basic code for creating what the spec wants looks like this:

stream := WriteStream on: String new.
stringToHash asByteArray md5Value printOn: stream base: 16.
hashString := stream contents.

Now, that's a mouthful to write everywhere I needed it (digest auth has you hash a bunch of stuff). So, I added a method to class String, so that I could just call it naturally:

md5Hash
	"answer a hexadecimal encoded hash"

	| stream |
	stream := WriteStream on: String new.
	self asByteArray md5Value printOn: stream base: 16.
	^stream contents asLowercase

Which allowed me to get the hash string easily, That's one of the niftiest things about Smalltalk, actually - the ability to toss extension code exactly where it belongs, which ends up empowering the developer later on - it's just that much less code to write downstream

In any event, Digest Authorization is now in Bf; enjoy! I'd like to thank Mark for providing a test site for me to hit (and a nice sample request!), and Michael Lucas-Smith for some useful tips when I was a little stuck

Read: Digest Authorization support

Topic: Source Files and Car Engines Previous Topic   Next Topic Topic: Objects? What are those?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use