token_auth 0.3.3 → 0.4.0

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: 27207ac1df988acfddf0064bb05d100092210008
4
- data.tar.gz: 6b5421cd231b363e984f186f21f74170ae989b2f
3
+ metadata.gz: 429cf19fb37c7fa13df5d0975afff2f495f44c48
4
+ data.tar.gz: 619d2fde74615297470a98788e85ca4ebb712ed8
5
5
  SHA512:
6
- metadata.gz: 3c4161e8d9d3838a04e66967dcd3b4eb933fd0afa2584bfa891efec9b5cafb62600cd54f6a7d559867c3500987358d622d3f818cb0c5d7535a26b178c55d7452
7
- data.tar.gz: dd7bf5622f258de8d9f1b6467be2a7dd7986842890ecd56855ab8e0ff68f1d5590a104ca1776f065ea9c7ee945b5bc1f2949fb191d1974ffc402bbab02a3424e
6
+ metadata.gz: 341590e01512f1c3b1b04711003ad5c7619bd81f7bdd2979002dd028bc544472a8634888b1fecf6cf50e3563b2adb3555137cf5a4a1abe545ba1ab653bce8261
7
+ data.tar.gz: 2ac88f338d46e5379922d7c3f0dcdd524a5e8366a13677bf151ca94445aec163c5add2dd49a8a8891584b1302d908494649d51ede9ec8b984c79ba32ef825e91
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  begin
3
4
  require "bundler/setup"
4
5
  rescue LoadError
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  module Api
4
5
  class BaseController < ActionController::Base
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "openssl"
3
4
 
4
5
  module TokenAuth
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  # Manages Authentication Tokens.
4
5
  class AuthenticationTokensController < ::TokenAuth::BaseController
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  class BaseController < ApplicationController
4
5
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  module Concerns
4
5
  # Behavior related to authentication and CORS.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  module Concerns
4
5
  # Allow cross-domain requests.
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  # Manages Configuration Tokens.
4
5
  class ConfigurationTokensController < ApplicationController
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  # Manage configuration and authentication tokens.
4
5
  class TokensController < ::TokenAuth::BaseController
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TokenAuth
4
+ # Superclass for models.
5
+ class ApplicationRecord < ActiveRecord::Base
6
+ self.abstract_class = true
7
+ end
8
+ end
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  # A key shared with a client for authenticating requests.
4
- class AuthenticationToken < ActiveRecord::Base
5
+ class AuthenticationToken < ApplicationRecord
5
6
  TOKEN_LENGTH = 32
6
7
  UUID_LENGTH = 36
7
8
 
@@ -2,12 +2,12 @@
2
2
 
3
3
  module TokenAuth
4
4
  # A single use human readable token for use with client configuration.
5
- class ConfigurationToken < ActiveRecord::Base
5
+ class ConfigurationToken < ApplicationRecord
6
6
  mattr_accessor :valid_period
7
7
  self.valid_period = 4.hours
8
- SAMPLE_SET = %w( A B C D E F H J K L M N P Q R S T U V W X Y Z
8
+ SAMPLE_SET = %w[ A B C D E F H J K L M N P Q R S T U V W X Y Z
9
9
  2 3 4 5 7 8 9
10
- # $ ).freeze
10
+ # $ ].freeze
11
11
  TOKEN_LENGTH = 6
12
12
 
13
13
  validates :expires_at, :entity_id, :value, presence: true
@@ -41,7 +41,7 @@ module TokenAuth
41
41
  end
42
42
 
43
43
  authentication_token
44
- rescue
44
+ rescue StandardError
45
45
  nil
46
46
  end
47
47
 
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  # An inbound resource. Inbound resource requests are validated and an
4
5
  # attempt is made to upsert them.
@@ -10,7 +11,6 @@ module TokenAuth
10
11
 
11
12
  def self.resource_type(params)
12
13
  params.extract!(:type)[:type]
13
-
14
14
  rescue NoMethodError
15
15
  nil
16
16
  end
@@ -60,7 +60,6 @@ module TokenAuth
60
60
  else
61
61
  @errors << resource.errors.full_messages.join(", ")
62
62
  end
63
-
64
63
  rescue ActiveRecord::UnknownAttributeError => error
65
64
  @errors << error.message
66
65
  end
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  # A resource that may be pushed and/or pulled by an entity.
4
- class SynchronizableResource < ActiveRecord::Base
5
+ class SynchronizableResource < ApplicationRecord
5
6
  include UuidEnabled
6
7
 
7
8
  validates :uuid, :entity_id, :entity_id_attribute_name, :name, :class_name,
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "active_support/concern"
3
4
 
4
5
  module TokenAuth
@@ -1,8 +1,12 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  # Serializer for SynchronizableResource.
4
5
  class SynchronizableResourceSerializer < ActiveModel::Serializer
5
6
  attributes :name
6
- attribute :uuid, key: :id
7
+
8
+ def id
9
+ object.uuid
10
+ end
7
11
  end
8
12
  end
@@ -1,27 +1,10 @@
1
1
  {
2
2
  "ignored_warnings": [
3
- {
4
- "warning_type": "Cross-Site Request Forgery",
5
- "warning_code": 7,
6
- "fingerprint": "c674d468288bd469bd3118d61dc6a38738f84047fe7a8ee381cdc7786a51c8cd",
7
- "message": "'protect_from_forgery' should be called in TokenAuth::Api::PayloadsController",
8
- "file": "app/controllers/token_auth/api/payloads_controller.rb",
9
- "line": 7,
10
- "link": "http://brakemanscanner.org/docs/warning_types/cross-site_request_forgery/",
11
- "code": null,
12
- "render_path": null,
13
- "location": {
14
- "type": "controller",
15
- "controller": "TokenAuth::Api::PayloadsController"
16
- },
17
- "user_input": null,
18
- "confidence": "High",
19
- "note": ""
20
- },
21
3
  {
22
4
  "warning_type": "Cross-Site Request Forgery",
23
5
  "warning_code": 7,
24
6
  "fingerprint": "f4b575f7a0660e776b6f6a29f548beb56b6b506e386fe386430ba52e25c3f350",
7
+ "check_name": "ForgerySetting",
25
8
  "message": "'protect_from_forgery' should be called in TokenAuth::Api::BaseController",
26
9
  "file": "app/controllers/token_auth/api/base_controller.rb",
27
10
  "line": 4,
@@ -37,6 +20,6 @@
37
20
  "note": ""
38
21
  }
39
22
  ],
40
- "updated": "2017-01-09 11:10:39 -0600",
41
- "brakeman_version": "3.4.1"
23
+ "updated": "2017-11-21 13:52:05 -0600",
24
+ "brakeman_version": "4.0.1"
42
25
  }
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require "token_auth/engine"
3
4
 
4
5
  require "active_model_serializers"
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module TokenAuth
3
4
  # Engine application superclass.
4
5
  class Engine < ::Rails::Engine
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Engine version.
3
4
  module TokenAuth
4
- VERSION = "0.3.3"
5
+ VERSION = "0.4.0"
5
6
  end
metadata CHANGED
@@ -1,71 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: token_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Carty-Fickes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-29 00:00:00.000000000 Z
11
+ date: 2017-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '='
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.10.0.rc3
19
+ version: 0.10.7
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
- version: 0.10.0.rc3
26
+ version: 0.10.7
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: actionpack
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 5.0.1
33
+ version: '5.1'
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
- version: 5.0.1
40
+ version: '5.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activerecord
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '='
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 5.0.1
47
+ version: '5.1'
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
- version: 5.0.1
54
+ version: '5.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: railties
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 5.0.1
61
+ version: '5.1'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '='
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 5.0.1
68
+ version: '5.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: sprockets-rails
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 3.5.X
103
+ version: '3.7'
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
- version: 3.5.X
110
+ version: '3.7'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: capybara
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - '='
144
144
  - !ruby/object:Gem::Version
145
- version: 0.47.1
145
+ version: '0.51'
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
- version: 0.47.1
152
+ version: '0.51'
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: mdl
155
155
  requirement: !ruby/object:Gem::Requirement
@@ -198,6 +198,7 @@ files:
198
198
  - app/controllers/token_auth/concerns/cors_settings.rb
199
199
  - app/controllers/token_auth/configuration_tokens_controller.rb
200
200
  - app/controllers/token_auth/tokens_controller.rb
201
+ - app/models/token_auth/application_record.rb
201
202
  - app/models/token_auth/authentication_token.rb
202
203
  - app/models/token_auth/configuration_token.rb
203
204
  - app/models/token_auth/payload.rb