Skip to content

Commit

Permalink
comments to clarify simple auth
Browse files Browse the repository at this point in the history
  • Loading branch information
automatthew committed Oct 14, 2008
1 parent db70bc2 commit 30116e8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions samples/blog/resources/entry.rb
Expand Up @@ -5,8 +5,11 @@ class Entry < Default

def basic_auth
raise Waves::Dispatchers::Unauthorized unless auth = @request.http_variable('Authorization')
# Header value should look like: "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
scheme, credentials = auth.split(' ', 2)
raise Waves::Dispatchers::BadRequest unless scheme == "Basic"
# "m*" is the code for Base64
# decoded value looks like "user:password"
credentials.unpack("m*").first.split(/:/, 2)
end

Expand Down

0 comments on commit 30116e8

Please sign in to comment.