Changeset 5667
- Timestamp:
- 12/03/06 01:05:49 (2 years ago)
- Files:
-
- plugins/http_authentication/lib/http_authentication.rb (modified) (1 diff)
- plugins/http_authentication/lib/http_authentication/digest.rb (modified) (2 diffs)
- plugins/http_authentication/README (modified) (2 diffs)
- plugins/http_authentication/test/basic_test.rb (moved) (moved from plugins/http_authentication/test/http_authentication_test.rb) (1 diff)
- plugins/http_authentication/test/digest_test.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/http_authentication/lib/http_authentication.rb
r5665 r5667 1 1 require 'http_authentication/basic' 2 # IMPLEMENT ME: require 'http_authentication/digest' plugins/http_authentication/lib/http_authentication/digest.rb
r5665 r5667 22 22 23 23 def user_name_and_password(request) 24 Base64.decode64(credentials(request)).split(/:/, 2) 25 end 26 27 def credentials(request) 28 authorization(request).split.last 24 decode_credentials(request).split(/:/, 2) 29 25 end 30 26 … … 35 31 end 36 32 33 def decode_credentials(request) 34 # Fancy nouncing goes here 35 end 36 37 def encode_credentials(user_name, password) 38 # You compute me 39 end 40 37 41 def authentication_request(controller, realm) 38 controller.headers["WWW-Authenticate"] = %(Basic realm="#{realm.gsub(/"/, "")}")42 # Proper headers 39 43 controller.render :text => "Access denied.\n", :status => :unauthorized 40 44 return false plugins/http_authentication/README
r5666 r5667 2 2 =================== 3 3 4 Makes it dead easy to do HTTP authentication using either the vanilla Basic or the more advanced Digest approach.4 Makes it dead easy to do HTTP Basic authentication. 5 5 6 6 Simple Basic example: … … 70 70 end 71 71 72 72 73 Todo: 73 74 74 * Implement Digest authentication scheme 75 * Implement Digest authentication scheme (be a hero, implement it!) 75 76 76 77 plugins/http_authentication/test/basic_test.rb
r5666 r5667 3 3 require 'http_authentication' 4 4 5 class Http AuthenticationTest < Test::Unit::TestCase5 class HttpBasicAuthenticationTest < Test::Unit::TestCase 6 6 include HttpAuthentication::Basic 7 7