devise_oauth2_rails4 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ad0e15ec79488248298982fcf833bd85b03358d5
4
- data.tar.gz: b26a39c3065e052a1fe782d33237347d1ca6e320
3
+ metadata.gz: 43f1c01227d95a7251f63db184def519327bbe6a
4
+ data.tar.gz: 655aa46acc2ead250f5ae1e2dbefef253aa573a7
5
5
  SHA512:
6
- metadata.gz: 62ccff4b3461bf7592b9915a7a81e9d12b14f8520514b2053bfbf943afaface7225d4f86e1d526133d396ae5e26e693a52e3e9a669aeaea65490b380e038accb
7
- data.tar.gz: 84dd9b90a0d08724d437e136f5eda3cc4ec4a07c34610ba4cc63968bba91c3426fa7dda2bebabbbedb110c215970ee5c02da99663f75528765829976c754e395
6
+ metadata.gz: c6aeff0d62391d4ee96f57c02480db0a610548972507dc22e7437dc4d03111a7349a5391f5fcad431ed4066466411491ce4ad0c4750d442fc91e788a40faa439
7
+ data.tar.gz: a9aea87c2afdd5f466472621f4934d9131b25f2a39f4b647a5bf0af5d28edc8ca83a44727df3f20fcc5e051d37ac0112f95d9f08604f5fb5a357579cf57155ae
@@ -5,14 +5,18 @@ module Devise
5
5
 
6
6
  def current_oauth2_client(opts: { secure: false })
7
7
  return @secure_client ||= Client.find_by(secret: client_secret) if opts[:secure]
8
- return @secure_client ||= Client.find_by(id: current_access_token.client_id) if access_token?
8
+ return @secure_client ||= Client.find_by(id: current_access_token.client_id) if valid_access_token?
9
9
  @client ||= Client.find_by('identifier = :client_id OR secret = :secret', client_id: client_id, secret: client_secret) if client_credentials?
10
10
  end
11
11
 
12
12
  def current_access_token
13
- @access_token ||= AccessToken.find_by(token: access_token)
13
+ @access_token ||= AccessToken.find_by(token: access_token) if accesss_token?
14
14
  end
15
15
 
16
+ def valid_access_token?
17
+ !!current_access_token
18
+ end
19
+
16
20
  def oauth2_client_signed_in?
17
21
  !!@client
18
22
  end
@@ -4,7 +4,7 @@ module Devise
4
4
 
5
5
  #include ::PermissionsHelper
6
6
 
7
- #before_action :authenticate_user!
7
+ before_action "authenticate_#{Rails.application.config.devise_oauth2_rails4.devise_scope}!"
8
8
  around_action :perform_callbacks
9
9
 
10
10
  rescue_from Rack::OAuth2::Server::Authorize::BadRequest do |e|
@@ -5,7 +5,7 @@ module Devise
5
5
  config.devise_oauth2_rails4.access_token_expires_in = 15.minutes
6
6
  config.devise_oauth2_rails4.refresh_token_expires_in = 1.month
7
7
  config.devise_oauth2_rails4.authorization_code_expires_in = 1.minute
8
-
8
+ config.devise_oauth2_rails4.devise_scope = :user
9
9
  engine_name 'oauth2'
10
10
  isolate_namespace Devise::Oauth2
11
11
  initializer "devise_oauth2_rails4.initialize_application", :before=> :load_config_initializers do |app|
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module Oauth2
3
- VERSION = "2.0.2"
3
+ VERSION = "2.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_oauth2_rails4
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Wheeler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-12 00:00:00.000000000 Z
11
+ date: 2014-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: devise
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.4.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.4.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rack-oauth2
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.11.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.11.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-rails
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 2.6.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 2.6.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sqlite3
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: 1.3.5
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.3.5
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: shoulda-matchers
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.0.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: 1.0.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: pry
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.9.6.2
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.9.6.2
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: factory_girl
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: 2.2.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: 2.2.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: factory_girl_rspec
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.0.1
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.0.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rake
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: 0.9.2.2
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: 0.9.2.2
153
153
  description: Rails 4 engine that adds OAuth2 Provider support to any application built
@@ -158,9 +158,9 @@ executables: []
158
158
  extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
- - .gitignore
162
- - .ruby-gemset
163
- - .ruby-version
161
+ - ".gitignore"
162
+ - ".ruby-gemset"
163
+ - ".ruby-version"
164
164
  - CONTRIBUTORS.txt
165
165
  - Gemfile
166
166
  - LICENSE.txt
@@ -275,12 +275,12 @@ require_paths:
275
275
  - lib
276
276
  required_ruby_version: !ruby/object:Gem::Requirement
277
277
  requirements:
278
- - - '>='
278
+ - - ">="
279
279
  - !ruby/object:Gem::Version
280
280
  version: '0'
281
281
  required_rubygems_version: !ruby/object:Gem::Requirement
282
282
  requirements:
283
- - - '>='
283
+ - - ">="
284
284
  - !ruby/object:Gem::Version
285
285
  version: '0'
286
286
  requirements: []
@@ -357,3 +357,4 @@ test_files:
357
357
  - spec/spec_helper.rb
358
358
  - spec/support/inject_engine_routes_into_application.rb
359
359
  - spec/support/match_json.rb
360
+ has_rdoc: