token_authenticate_me 0.5.4 → 0.5.5

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: 014ea05ef85b51fefd546c3810d22ceb01c1949a
4
- data.tar.gz: 32299428b5e1198b06350a8b3cc5c6e9ca56e291
3
+ metadata.gz: 311f92f7a78f01a264d0b936eaa9f84401bf01a5
4
+ data.tar.gz: 101238b569d8a8589d5ac9e3cd39d8000d961a46
5
5
  SHA512:
6
- metadata.gz: 77265c9a971f4cd560dc6cf6ce3272d86c42ebba02d29714147e34f59f047ede1227ef88bb52a38beabc3a8541fcf6867fec752a415848afc160ba45e3593c5b
7
- data.tar.gz: fe1899c608ce5be093d59417eb03beaf2431e7c3807637bb8a43897aa693ee95e1a18310fb5564655496795ee0339e95145892162ca18ea6ae5efff7f09ec248
6
+ metadata.gz: f9bfe4a07d52b2b6ab96c8324f41523b6f64161294a58be96d1e67530955feafa8e2675a88e179f3c4b3ba91a5288337bdaa18b7518d2b97858e9e203ebb0b49
7
+ data.tar.gz: 7290e71439f2e27d462d5b2df6b21e9d11dfe591f76da1a1596ef77025b9e9a2c83f8f24f1721a0e9a0a9c0a01d0586ce663caff25c6ebc5a2687bdf5b2867a8
@@ -1,6 +1,7 @@
1
1
  require 'active_support/concern'
2
2
  require 'token_authenticate_me/concerns/controllers/authenticateable'
3
3
  require 'token_authenticate_me/header_authentication'
4
+ require 'token_authenticate_me/param_authentication'
4
5
 
5
6
  module TokenAuthenticateMe
6
7
  module Concerns
@@ -18,7 +19,7 @@ module TokenAuthenticateMe
18
19
  protected
19
20
 
20
21
  def authenticated_session
21
- @session ||= authenticate_with_header
22
+ @session ||= (authenticate_with_header || authenticate_with_params)
22
23
  end
23
24
 
24
25
  def authenticate_with_header
@@ -27,8 +28,8 @@ module TokenAuthenticateMe
27
28
  end
28
29
 
29
30
  def authenticate_with_params
30
- token = params[:authentication_token]
31
- token_handler(token, {})
31
+ header_authentication = TokenAuthenticateMe::ParamAuthentication.new(controller: self)
32
+ header_authentication.authenticate
32
33
  end
33
34
 
34
35
  def render_unauthorized
@@ -0,0 +1,24 @@
1
+ module TokenAuthenticateMe
2
+ class ParamAuthentication
3
+ attr :controller
4
+
5
+ def initialize(controller:)
6
+ @controller = controller
7
+ end
8
+
9
+ def authenticate(options = {})
10
+ token_handler(token, options)
11
+ end
12
+
13
+ private
14
+
15
+ def token
16
+ controller.params[:authentication_token]
17
+ end
18
+
19
+ def token_handler(token, options)
20
+ controller.token_handler(token, options)
21
+ end
22
+ end
23
+ end
24
+
@@ -1,3 +1,3 @@
1
1
  module TokenAuthenticateMe
2
- VERSION = '0.5.4'.freeze
2
+ VERSION = '0.5.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: token_authenticate_me
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Clopton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-11 00:00:00.000000000 Z
12
+ date: 2017-03-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0.6'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bcrypt
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 3.1.7
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 3.1.7
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: pg
44
58
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +123,7 @@ files:
109
123
  - lib/token_authenticate_me/engine.rb
110
124
  - lib/token_authenticate_me/header_authentication.rb
111
125
  - lib/token_authenticate_me/models.rb
126
+ - lib/token_authenticate_me/param_authentication.rb
112
127
  - lib/token_authenticate_me/session_authentication.rb
113
128
  - lib/token_authenticate_me/version.rb
114
129
  - test/dummy/README.rdoc
@@ -174,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
189
  version: '0'
175
190
  requirements: []
176
191
  rubyforge_project:
177
- rubygems_version: 2.4.5.1
192
+ rubygems_version: 2.5.1
178
193
  signing_key:
179
194
  specification_version: 4
180
195
  summary: This gem adds simple token authentication to users.