jpablobr-sinatra-authorization 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1 +1,6 @@
1
1
  dist
2
+ .DS_Store
3
+ tmp
4
+ pkg
5
+ *.gem
6
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -0,0 +1,46 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{jpablobr-sinatra-authorization}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jose Pablo Barrantes"]
12
+ s.date = %q{2010-04-25}
13
+ s.description = %q{jpablobr-sinatra-authorization HTTP Authorization helpers for Sinatra.}
14
+ s.email = %q{xjpablobrx@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.rdoc"
17
+ ]
18
+ s.files = [
19
+ ".gitignore",
20
+ "README.rdoc",
21
+ "Rakefile",
22
+ "VERSION",
23
+ "jpablobr-sinatra-authorization.gemspec",
24
+ "lib/sinatra/authorization.rb",
25
+ "test/authorization_test.rb"
26
+ ]
27
+ s.homepage = %q{http://github.com/jpablobr/sinatra-authorization}
28
+ s.rdoc_options = ["--charset=UTF-8"]
29
+ s.require_paths = ["lib"]
30
+ s.rubygems_version = %q{1.3.6}
31
+ s.summary = %q{jpablobr-sinatra-authorization HTTP Authorization helpers for Sinatra.}
32
+ s.test_files = [
33
+ "test/authorization_test.rb"
34
+ ]
35
+
36
+ if s.respond_to? :specification_version then
37
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
38
+ s.specification_version = 3
39
+
40
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
41
+ else
42
+ end
43
+ else
44
+ end
45
+ end
46
+
@@ -22,7 +22,7 @@ module Sinatra
22
22
  # From you app, call set :authorization_realm, "my app" to set this
23
23
  # or define a #authorization_realm method in your helpers block.
24
24
  def authorization_realm
25
- Sinatra::Default.authorization_realm
25
+ options.authorization_realm
26
26
  end
27
27
 
28
28
  # Call in any event that requires authentication
@@ -36,12 +36,15 @@ module Sinatra
36
36
 
37
37
  # Convenience method to determine if a user is logged in
38
38
  def authorized?
39
- !!request.env['REMOTE_USER']
39
+ #!!request.env['REMOTE_USER']
40
+ !!current_user
40
41
  end
41
42
  alias :logged_in? :authorized?
42
43
 
43
44
  # Name provided by the current user to log in
44
45
  def current_user
46
+ request.env['REMOTE_USER'] = auth.username if
47
+ auth.provided? && auth.basic? && authorize(*auth.credentials)
45
48
  request.env['REMOTE_USER']
46
49
  end
47
50
 
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 1
7
+ - 2
8
8
  - 0
9
- version: 0.1.0
9
+ version: 0.2.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jose Pablo Barrantes
@@ -31,6 +31,7 @@ files:
31
31
  - README.rdoc
32
32
  - Rakefile
33
33
  - VERSION
34
+ - jpablobr-sinatra-authorization.gemspec
34
35
  - lib/sinatra/authorization.rb
35
36
  - test/authorization_test.rb
36
37
  has_rdoc: true