exvo-auth 0.7.9 → 0.7.10

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.9
1
+ 0.7.10
data/exvo-auth.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{exvo-auth}
8
- s.version = "0.7.9"
8
+ s.version = "0.7.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jacek Becela"]
@@ -2,7 +2,7 @@ module ExvoAuth::Controllers::Base
2
2
  def self.included(base)
3
3
  raise "Please define a #root_url method in #{base.name} (or in routes)" unless base.method_defined? :root_url
4
4
  end
5
-
5
+
6
6
  # A before filter to protect your sensitive actions.
7
7
  def authenticate_user!
8
8
  if !signed_in?
@@ -41,6 +41,21 @@ module ExvoAuth::Controllers::Base
41
41
  @current_user = nil
42
42
  redirect_to sign_out_url(return_to)
43
43
  end
44
+
45
+ def authenticate_app_in_scope!(scope)
46
+ raise("SSL not configured") unless request.ssl?
47
+
48
+ send(basic_authentication_method_name) do |consumer_id, access_token|
49
+ current_scopes = ExvoAuth::Autonomous::Provider.new(
50
+ :consumer_id => consumer_id,
51
+ :access_token => access_token
52
+ ).scopes
53
+
54
+ @current_consumer_id = consumer_id
55
+
56
+ current_scopes.include?(scope)
57
+ end
58
+ end
44
59
 
45
60
  def sign_in_path
46
61
  "/auth/interactive"
@@ -62,7 +77,7 @@ module ExvoAuth::Controllers::Base
62
77
  def signed_in?
63
78
  !!current_user
64
79
  end
65
-
80
+
66
81
  protected
67
82
 
68
83
  def store_location!
@@ -9,34 +9,11 @@ module ExvoAuth::Controllers::Merb
9
9
  super
10
10
  throw :halt unless signed_in?
11
11
  end
12
-
13
- def authenticate_app_in_scope!(scope)
14
- basic_authentication do |consumer_id, access_token|
15
- current_scopes = ExvoAuth::Autonomous::Provider.new(
16
- :consumer_id => consumer_id,
17
- :access_token => access_token
18
- ).scopes
19
-
20
- @current_consumer_id = consumer_id
21
-
22
- if !request.ssl?
23
- error("Auth: SSL not configured")
24
- return false
25
- end
26
-
27
- if !current_scopes.include?(scope)
28
- error("Auth: Requested scope (#{scope}) not in a list: #{current_scopes.join(', ')}")
29
- return false
30
- end
31
-
32
- true
33
- end
34
- end
35
12
 
36
13
  protected
37
-
38
- def error(message)
39
- Merb.logger.error(message) if defined?(Merb.logger)
14
+
15
+ def basic_authentication_method_name
16
+ :basic_authentication
40
17
  end
41
18
 
42
19
  def redirect_to(*args)
@@ -6,21 +6,12 @@ module ExvoAuth::Controllers::Rails
6
6
  end
7
7
 
8
8
  module InstanceMethods
9
- def authenticate_app_in_scope!(scope)
10
- authenticate_or_request_with_http_basic do |consumer_id, access_token|
11
- current_scopes = ExvoAuth::Autonomous::Provider.new(
12
- :consumer_id => consumer_id,
13
- :access_token => access_token
14
- ).scopes
15
-
16
- @current_consumer_id = consumer_id
17
-
18
- current_scopes.include?(scope) && request.ssl?
19
- end
20
- end
21
-
22
9
  protected
23
-
10
+
11
+ def basic_authentication_method_name
12
+ :authenticate_or_request_with_http_basic
13
+ end
14
+
24
15
  def find_user_by_id(id)
25
16
  User.find(id)
26
17
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 9
9
- version: 0.7.9
8
+ - 10
9
+ version: 0.7.10
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jacek Becela