grape_token_auth 0.1.0 → 0.1.1

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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/CHANGELOG.md +13 -0
  4. data/README.md +4 -3
  5. data/lib/grape_token_auth.rb +4 -0
  6. data/lib/grape_token_auth/api_helpers.rb +1 -0
  7. data/lib/grape_token_auth/apis/confirmation_api.rb +2 -1
  8. data/lib/grape_token_auth/apis/omniauth_api.rb +13 -3
  9. data/lib/grape_token_auth/apis/password_api.rb +2 -1
  10. data/lib/grape_token_auth/apis/registration/endpoint_definer.rb +38 -0
  11. data/lib/grape_token_auth/apis/registration/helpers.rb +61 -0
  12. data/lib/grape_token_auth/apis/registration_api.rb +3 -68
  13. data/lib/grape_token_auth/apis/session_api.rb +6 -5
  14. data/lib/grape_token_auth/apis/token_validation_api.rb +1 -0
  15. data/lib/grape_token_auth/authentication_header.rb +1 -0
  16. data/lib/grape_token_auth/authorizer_data.rb +1 -0
  17. data/lib/grape_token_auth/configuration.rb +1 -0
  18. data/lib/grape_token_auth/exceptions.rb +1 -0
  19. data/lib/grape_token_auth/key_generator.rb +1 -0
  20. data/lib/grape_token_auth/lookup_token.rb +1 -0
  21. data/lib/grape_token_auth/mail/mail.rb +1 -0
  22. data/lib/grape_token_auth/mail/message_base.rb +1 -0
  23. data/lib/grape_token_auth/mail/messages/confirmation/confirmation_email.rb +1 -0
  24. data/lib/grape_token_auth/mail/messages/password_reset/password_reset_email.rb +1 -0
  25. data/lib/grape_token_auth/mail/smtp_mailer.rb +1 -0
  26. data/lib/grape_token_auth/middleware.rb +1 -0
  27. data/lib/grape_token_auth/mount_helpers.rb +1 -0
  28. data/lib/grape_token_auth/omniauth/omniauth_failure_html.rb +1 -0
  29. data/lib/grape_token_auth/omniauth/omniauth_html_base.rb +1 -0
  30. data/lib/grape_token_auth/omniauth/omniauth_resource.rb +1 -0
  31. data/lib/grape_token_auth/omniauth/omniauth_success_html.rb +1 -0
  32. data/lib/grape_token_auth/orm_integrations/active_record_token_auth.rb +14 -4
  33. data/lib/grape_token_auth/resource/resource_creator.rb +1 -0
  34. data/lib/grape_token_auth/resource/resource_crud_base.rb +3 -2
  35. data/lib/grape_token_auth/resource/resource_finder.rb +1 -0
  36. data/lib/grape_token_auth/resource/resource_updater.rb +1 -0
  37. data/lib/grape_token_auth/token.rb +1 -0
  38. data/lib/grape_token_auth/token_authentication.rb +1 -0
  39. data/lib/grape_token_auth/token_authorizer.rb +1 -0
  40. data/lib/grape_token_auth/unauthorized_middleware.rb +1 -0
  41. data/lib/grape_token_auth/utility.rb +1 -0
  42. data/lib/grape_token_auth/version.rb +2 -1
  43. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6211636ade2d82f854a1581aa553db28d969bae2
4
- data.tar.gz: 67430fb3d2e77ab25f6adcf881e81549dd66de4f
3
+ metadata.gz: 9eb52d69bb4f5d993b5dabb72d6e69c1e6aab019
4
+ data.tar.gz: 92258e86affff9fc05ef494a80f242510f9802fa
5
5
  SHA512:
6
- metadata.gz: 48cb9baa1072a05831fc280bc671cd81ba65e056439d499abcdb1ba6617132768fe14e37682d1e3debd2b8792026662b45baf165ccc07ca2ba1ecbf44d2653c0
7
- data.tar.gz: 9b7f0fbd5cc1c06c7a323583130ea4ee580775f49bb0450e7dff27920c7a9fe2569ff21c2c4c50c24d4dfd2dab3a2c6878a22ca0105f16172922c06b6d820125
6
+ metadata.gz: 1903c2ca38a0b489c469805efef6c2b5a569eafc0838a76c72f65d2a4b440779f314f9101b52c006c03cf7dc417cdf485ccab7b623f4737eae94a3c16255e7f6
7
+ data.tar.gz: e5725e0048fe7549bf9054ec7ddaa309bd3ed94ef862d796a116abe131cbd6681d3832b63d5e0ffe35df6238e09c78ad6a0688f9becabd6a8143510aae3ab9ff
@@ -1 +1 @@
1
- 2.2.0
1
+ 2.3.1
@@ -0,0 +1,13 @@
1
+ #Changelog
2
+
3
+ ## Current
4
+
5
+ - Add frozen string comments for ruby 2.3
6
+ - Fix several bugs around rails sign out and session
7
+ - Fix insensitive_keys bug with devise compatability
8
+ - Fix some compatability issues with Grape version 0.16
9
+
10
+
11
+ ## v0.1.0 Initial Release (2015-11-10)
12
+
13
+ - Majority of devise_token_auth parity
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # GrapeTokenAuth
2
- [![Code Climate GPA][11]][12] [![Test Coverage][13]][14] [![Circle CI][15]][16]
2
+ [![Gem Version][17]][18] [![Code Climate GPA][11]][12] [![Test Coverage][13]][14] [![Circle CI][15]][16]
3
3
 
4
4
  GrapeTokenAuth is a token authentication solution for grape. It is compatible
5
5
  with [ng-token-auth][1] (for _angular_) and [j-toker][2] (for _jQuery_), and is
@@ -79,7 +79,6 @@ In _rails_, you will need to setup warden as so:
79
79
  config.middleware.insert_after ActionDispatch::Flash, Warden::Manager do |manager|
80
80
  manager.failure_app = GrapeTokenAuth::UnauthorizedMiddleware
81
81
  manager.default_scope = :user
82
- GrapeTokenAuth.configure_warden(manager)
83
82
  end
84
83
  ```
85
84
 
@@ -145,7 +144,7 @@ class TestApp < Grape::API
145
144
  # ...
146
145
 
147
146
  mount_registration(to: '/auth', for: :user)
148
- mount_session(to: '/auth', for: :user)
147
+ mount_sessions(to: '/auth', for: :user)
149
148
  mount_token_validation(to: '/auth', for: :user)
150
149
  mount_confirmation(to: '/auth', for: :user)
151
150
 
@@ -244,6 +243,8 @@ To run tests, you will need postgres to be setup and configured correctly. Run
244
243
  [14]: https://codeclimate.com/github/mcordell/grape_token_auth/coverage
245
244
  [15]: https://circleci.com/gh/mcordell/grape_token_auth.svg?style=svg
246
245
  [16]: https://circleci.com/gh/mcordell/grape_token_auth
246
+ [17]: https://badge.fury.io/rb/grape_token_auth.svg
247
+ [18]: https://badge.fury.io/rb/grape_token_auth
247
248
  [contributing]: https://github.com/mcordell/grape_token_auth/blob/master/CONTRIBUTING.md
248
249
  [gta-wiki]: https://github.com/mcordell/grape_token_auth/wiki
249
250
  [demo-repo]: https://github.com/mcordell/grape_token_auth_demo
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'bcrypt'
2
3
  require 'forwardable'
3
4
  require 'grape'
@@ -7,6 +8,9 @@ require 'grape_token_auth/mail/message_base'
7
8
  require 'grape_token_auth/omniauth/omniauth_html_base'
8
9
  require 'grape_token_auth/resource/resource_crud_base'
9
10
 
11
+ require 'grape_token_auth/apis/registration/endpoint_definer'
12
+ require 'grape_token_auth/apis/registration/helpers'
13
+
10
14
  require 'grape_token_auth/api_helpers'
11
15
  require 'grape_token_auth/apis/confirmation_api'
12
16
  require 'grape_token_auth/apis/omniauth_api'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  module ApiHelpers
3
4
  def self.included(base)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  # Module that contains the majority of the email confirming functionality.
3
4
  # This module can be included in a Grape::API class that defines a
@@ -10,7 +11,7 @@ module GrapeTokenAuth
10
11
  base.resource_scope)
11
12
  resource = resource_class.confirm_by_token(params[:confirmation_token])
12
13
 
13
- if resource.persisted?
14
+ if resource && resource.persisted?
14
15
  token = Token.new
15
16
 
16
17
  resource.tokens[token.client_id] = {
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  # Module that contains the majority of the OmniAuth functionality. This module
3
4
  # can be included in a Grape::API class that defines a resource_scope and
@@ -6,7 +7,14 @@ module GrapeTokenAuth
6
7
  def self.included(base)
7
8
  base.helpers do
8
9
  def auth_hash
9
- @auth_hash ||= request.env['rack.session'].delete('gta.omniauth.auth')
10
+ @auth_hash ||= begin
11
+ hash = request.env['rack.session'].delete('gta.omniauth.auth')
12
+
13
+ # While using Grape on Rails, #session is an ActionDispatch::Request::Session class,
14
+ # which does not preserve OmniAuth::AuthHash class @ 'gta.omniauth.auth' key,
15
+ # converting it to Hash. Restoring
16
+ hash.kind_of?(::OmniAuth::AuthHash) ? hash : ::OmniAuth::AuthHash.new(hash)
17
+ end
10
18
  end
11
19
 
12
20
  def omniauth_params
@@ -106,8 +114,10 @@ module GrapeTokenAuth
106
114
  helpers do
107
115
  def redirect_route_from_api(api, provider)
108
116
  prefix = api.routes.find do |r|
109
- %r{/:provider/callback}.match(r.route_path)
110
- end.route_path.split(%r{/:provider})[0]
117
+ minor = /0\.(\d\d).\d+/.match(Grape::VERSION)[1].to_i
118
+ path = minor >= 16 ? r.origin : r.path
119
+ %r{/:provider/callback}.match(path)
120
+ end.path.split(%r{/:provider})[0]
111
121
  Pathname.new(prefix).join(provider, 'callback.json').to_s
112
122
  end
113
123
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  # Module that contains the majority of the password reseting functionality.
3
4
  # This module can be included in a Grape::API class that defines a
@@ -32,7 +33,7 @@ module GrapeTokenAuth
32
33
  redirect_url ||= GrapeTokenAuth.configuration.default_password_reset_url
33
34
  throw_unauthorized('Missing redirect url.') unless redirect_url
34
35
  resource = ResourceFinder.find(base.resource_scope, params)
35
- edit_path = routes[0].route_path.gsub(/\(.*\)/, '') + "/edit"
36
+ edit_path = routes[0].path.gsub(/\(.*\)/, '') + "/edit"
36
37
  if resource
37
38
  resource.send_reset_password_instructions(
38
39
  provider: 'email',
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+ module GrapeTokenAuth
3
+ module Registration
4
+ class EndpointDefiner
5
+ def self.define_endpoints(api)
6
+ define_post(api)
7
+ define_delete(api)
8
+ define_put(api)
9
+ end
10
+
11
+ def self.define_post(api)
12
+ api.post '/' do
13
+ return present empty_params_error if empty_params_error
14
+ return present invalid_redirect_error if invalid_redirect_error
15
+ present_create(params, api.resource_scope)
16
+ end
17
+ end
18
+
19
+ def self.define_delete(api)
20
+ api.delete do
21
+ user = find_resource(env, api.resource_scope)
22
+ return present bad_request(['resource not found.'], 404) unless user
23
+ user.delete
24
+ status 200
25
+ end
26
+ end
27
+
28
+ def self.define_put(api)
29
+ api.put do
30
+ return present empty_params_error if empty_params_error
31
+ resource = find_resource(env, api.resource_scope)
32
+ return present no_resource unless resource
33
+ present_update(params, resource, api.resource_scope)
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+ module GrapeTokenAuth
3
+ module Registration
4
+ module Helpers
5
+ def bad_request(messages, code = 422)
6
+ status(code)
7
+ { 'status' => 'error', 'error' => messages.join(',') }
8
+ end
9
+
10
+ def invalid_redirect_error
11
+ white_list = GrapeTokenAuth.configuration.redirect_whitelist
12
+ return unless white_list
13
+ url_valid = white_list.include?(params['confirm_success_url'])
14
+ errors = ['redirect url is not in whitelist']
15
+ bad_request(errors, 403) unless url_valid
16
+ end
17
+
18
+ def present_update(params, resource, scope)
19
+ updater = ResourceUpdater.new(resource, params, nil, scope)
20
+ if updater.update!
21
+ present_success(updater.resource)
22
+ else
23
+ present bad_request(updater.errors, 403)
24
+ end
25
+ end
26
+
27
+ def present_create(params, scope)
28
+ creator = ResourceCreator.new(params, nil, scope)
29
+ if creator.create!
30
+ present_success(creator.resource)
31
+ else
32
+ present bad_request(creator.errors, 403)
33
+ end
34
+ end
35
+
36
+ def empty_params_error
37
+ if params.empty?
38
+ errors = ['email, password, password_confirmation \
39
+ params are required']
40
+ bad_request errors, 422
41
+ else
42
+ false
43
+ end
44
+ end
45
+
46
+ def no_resource
47
+ bad_request(['resource not found.'], 404)
48
+ end
49
+
50
+ def find_resource(env, mapping)
51
+ token_authorizer = TokenAuthorizer.new(AuthorizerData.from_env(env))
52
+ token_authorizer.find_resource(mapping)
53
+ end
54
+
55
+ def present_success(resource)
56
+ status 200
57
+ present(data: resource)
58
+ end
59
+ end
60
+ end
61
+ end
@@ -1,76 +1,11 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  module RegistrationAPICore
3
4
  def self.included(base)
4
5
  base.helpers do
5
- def bad_request(messages, code = 422)
6
- status(code)
7
- { 'status' => 'error', 'error' => messages.join(',') }
8
- end
9
-
10
- def validate_redirect_url!
11
- white_list = GrapeTokenAuth.configuration.redirect_whitelist
12
- return unless white_list
13
- url_valid = white_list.include?(params['confirm_success_url'])
14
- errors = ['redirect url is not in whitelist']
15
- bad_request(errors, 403) unless url_valid
16
- end
17
-
18
- def validate_not_empty!
19
- if params.empty?
20
- errors = ['email, password, password_confirmation \
21
- params are required']
22
- bad_request errors, 422
23
- else
24
- false
25
- end
26
- end
27
-
28
- def find_resource(env, mapping)
29
- token_authorizer = TokenAuthorizer.new(AuthorizerData.from_env(env))
30
- token_authorizer.find_resource(mapping)
31
- end
32
- end
33
-
34
- base.post '/' do
35
- empty_params_error = validate_not_empty!
36
- return present(empty_params_error) if empty_params_error
37
- redirect_error = validate_redirect_url!
38
- return present(redirect_error) if redirect_error
39
- mapping = base.resource_scope
40
- configuration = GrapeTokenAuth.configuration
41
- creator = ResourceCreator.new(params, configuration, mapping)
42
- if creator.create!
43
- status 200
44
- present(data: creator.resource)
45
- else
46
- present bad_request(creator.errors, 403)
47
- end
48
- end
49
-
50
- base.delete do
51
- user = find_resource(env, base.resource_scope)
52
- return present bad_request(['resource not found.'], 404) unless user
53
- user.delete
54
- status 200
55
- end
56
-
57
- base.put do
58
- empty_params_error = validate_not_empty!
59
- return present(empty_params_error) if empty_params_error
60
- resource = find_resource(env, base.resource_scope)
61
- return present bad_request(['resource not found.'], 404) unless resource
62
-
63
- updater = ResourceUpdater.new(resource,
64
- params,
65
- GrapeTokenAuth.configuration,
66
- base.resource_scope)
67
- if updater.update!
68
- status 200
69
- present(data: updater.resource)
70
- else
71
- present bad_request(updater.errors, 403)
72
- end
6
+ include GrapeTokenAuth::Registration::Helpers
73
7
  end
8
+ GrapeTokenAuth::Registration::EndpointDefiner.define_endpoints(base)
74
9
 
75
10
  base.format :json
76
11
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  module SessionsAPICore
3
4
  def self.included(base)
@@ -26,10 +27,7 @@ module GrapeTokenAuth
26
27
  data = AuthorizerData.load_from_env_or_create(env)
27
28
  env['rack.session'] ||= {}
28
29
  data.store_resource(resource, base.resource_scope)
29
- auth_header = AuthenticationHeader.new(data, start_time)
30
- auth_header.headers.each do |key, value|
31
- header key.to_s, value.to_s
32
- end
30
+ data.authed_with_token = false
33
31
  status 200
34
32
  present data: resource
35
33
  end
@@ -39,7 +37,10 @@ module GrapeTokenAuth
39
37
  resource = find_resource(data, base.resource_scope)
40
38
 
41
39
  if resource
42
- resource.tokens.delete(env[Configuration::CLIENT_KEY])
40
+ # Rails prepends 'CLIENT' header with 'HTTP_' prefix, so to make sure we address to
41
+ # proper header, better use normalized version stored at <tt>data</tt>
42
+ # See more: http://stackoverflow.com/a/26936364/1592582
43
+ resource.tokens.delete(data.client_id)
43
44
  data.skip_auth_headers = true
44
45
  resource.save
45
46
  status 200
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  # Contains the major functionality of TokenValidation
3
4
  module TokenValidationAPICore
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class AuthenticationHeader
3
4
  extend Forwardable
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class AuthorizerData
3
4
  RACK_ENV_KEY = 'gta.auth_data'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class Configuration
3
4
  ACCESS_TOKEN_KEY = 'access-token'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  # Error when an undefined scope was attempted to be used
3
4
  class ScopeUndefinedError < StandardError
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'thread_safe'
2
3
  require 'openssl'
3
4
  require 'securerandom'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  # Look up tokens are a type of token that allows searching by that token. This
3
4
  # is useful in use cases such as confirmation tokens. These type of tokens are
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  module Mail
3
4
  DEFAULT_MESSAGES = {
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  module Mail
3
4
  class MessageBase
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  module Mail
3
4
  class ConfirmationEmail < MessageBase
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  module Mail
3
4
  class PasswordResetEmail < MessageBase
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  module Mail
3
4
  class SMTPMailer
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class Middleware
3
4
  def initialize(app, _options)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  module MountHelpers
3
4
  def self.included(base)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class OmniAuthFailureHTML < OmniAuthHTMLBase
3
4
  FAILURE_MESSAGE = 'authFailure'
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  require 'erb'
2
3
  require 'json'
3
4
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class OmniAuthResource
3
4
  extend Forwardable
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class OmniAuthSuccessHTML < OmniAuthHTMLBase
3
4
  extend Forwardable
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  module ActiveRecord
3
4
  module TokenAuth
@@ -15,6 +16,15 @@ module GrapeTokenAuth
15
16
  base.before_update :synchronize_email_and_uid
16
17
 
17
18
  class << base
19
+ def case_insensitive_keys
20
+ @case_insensitive_keys ||
21
+ if Object.const_defined?(:Devise)
22
+ Object.const_get(:Devise).case_insensitive_keys
23
+ else
24
+ [:email]
25
+ end
26
+ end
27
+
18
28
  def exists_in_column?(column, value)
19
29
  where(column => value).count > 0
20
30
  end
@@ -59,7 +69,7 @@ module GrapeTokenAuth
59
69
 
60
70
  attr_writer :reset_token_lifespan
61
71
  attr_writer :confirmation_token_lifespan
62
- attr_accessor :case_insensitive_keys
72
+ attr_writer :case_insensitive_keys
63
73
  end
64
74
  end
65
75
 
@@ -81,8 +91,8 @@ module GrapeTokenAuth
81
91
  def password_confirmation_matches
82
92
  return if password.present? && password_confirmation.present? &&
83
93
  password == password_confirmation
84
- errors.add(:password_confirmation,
85
- 'password confirmation does not match')
94
+ errors.add(:base,
95
+ 'password and password confirmation do not match')
86
96
  end
87
97
 
88
98
  def create_new_auth_token(client_id = nil)
@@ -192,7 +202,7 @@ module GrapeTokenAuth
192
202
 
193
203
  def build_auth_url(url, params)
194
204
  url = URI(url)
195
- expiry = tokens[params[:client_id]][:expiry]
205
+ expiry = tokens[params[:client_id]].with_indifferent_access[:expiry]
196
206
  url.query = params.merge(uid: uid, expiry: expiry).to_query
197
207
  url.to_s
198
208
  end
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class ResourceCreator < ResourceCrudBase
3
4
  def create!
@@ -1,9 +1,10 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class ResourceCrudBase
3
4
  attr_reader :resource, :errors, :scope
4
5
 
5
- def initialize(params, configuration, scope = :user)
6
- @configuration = configuration
6
+ def initialize(params, configuration = nil, scope = :user)
7
+ @configuration = configuration || GrapeTokenAuth.configuration
7
8
  @params = params
8
9
  @errors = []
9
10
  @scope = scope
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class ResourceFinder
3
4
  def initialize(scope, params)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class ResourceUpdater < ResourceCrudBase
3
4
  def initialize(resource, params, configuration, scope = :user)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class Token
3
4
  attr_reader :token, :client_id, :expiry
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  module TokenAuthentication
3
4
  def self.included(base)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class TokenAuthorizer
3
4
  attr_reader :data
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class UnauthorizedMiddleware
3
4
  def self.call(env)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
3
  class Utility
3
4
  def self.find_with_indifference(hash, key)
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module GrapeTokenAuth
2
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
3
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape_token_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Cordell
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-10 00:00:00.000000000 Z
11
+ date: 2016-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape
@@ -259,6 +259,7 @@ files:
259
259
  - ".rspec"
260
260
  - ".ruby-version"
261
261
  - ".travis.yml"
262
+ - CHANGELOG.md
262
263
  - CONTRIBUTING.md
263
264
  - Gemfile
264
265
  - LICENSE.txt
@@ -275,6 +276,8 @@ files:
275
276
  - lib/grape_token_auth/apis/confirmation_api.rb
276
277
  - lib/grape_token_auth/apis/omniauth_api.rb
277
278
  - lib/grape_token_auth/apis/password_api.rb
279
+ - lib/grape_token_auth/apis/registration/endpoint_definer.rb
280
+ - lib/grape_token_auth/apis/registration/helpers.rb
278
281
  - lib/grape_token_auth/apis/registration_api.rb
279
282
  - lib/grape_token_auth/apis/session_api.rb
280
283
  - lib/grape_token_auth/apis/token_validation_api.rb
@@ -331,9 +334,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
331
334
  version: '0'
332
335
  requirements: []
333
336
  rubyforge_project:
334
- rubygems_version: 2.4.5
337
+ rubygems_version: 2.5.1
335
338
  signing_key:
336
339
  specification_version: 4
337
340
  summary: Token auth for grape apps
338
341
  test_files: []
339
- has_rdoc: