graphql_devise 1.1.1 → 1.3.0
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.
- checksums.yaml +4 -4
- data/.circleci/config.yml +17 -9
- data/.rubocop.yml +1 -1
- data/Appraisals +27 -13
- data/CHANGELOG.md +16 -0
- data/README.md +7 -0
- data/app/controllers/graphql_devise/graphql_controller.rb +1 -43
- data/graphql_devise.gemspec +1 -1
- data/lib/graphql_devise/concerns/auth_controller_methods.rb +50 -0
- data/lib/graphql_devise/route_mounter.rb +12 -2
- data/lib/graphql_devise/version.rb +1 -1
- data/spec/dummy/app/controllers/cookies_controller.rb +7 -0
- data/spec/dummy/config/routes.rb +8 -8
- data/spec/requests/mutations/login_spec.rb +10 -11
- metadata +8 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9a0911856ffb6f7569380f899bb033964977cf985144f13e985dd01e98f1164b
|
|
4
|
+
data.tar.gz: 5a3618481369b49e651efe2f6b13b5bd3f0e35b3f1b722b18cd67d83fc754680
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d6f19cd7498da32debc6a598e5f13474a9774c5e7c032c64b76818e5ed6cc75e54a8eafa80dbcf9bd28f7700f22d7352c68f16aa7c5f6901e3350ad4924c6d0d
|
|
7
|
+
data.tar.gz: bc6f6590ec88623f42871fc72b285a9087ebd21c545eb661992b14fac7a90c52bd3a4617b48ee54edf3645e4f1ce58c52f6c46ad25fb104dba8930c445c98aea
|
data/.circleci/config.yml
CHANGED
|
@@ -13,22 +13,14 @@ jobs:
|
|
|
13
13
|
- image: 'ruby:<< parameters.ruby-version >>'
|
|
14
14
|
environment:
|
|
15
15
|
BUNDLE_GEMFILE: << parameters.gemfile >>
|
|
16
|
-
BUNDLE_PATH: ../vendor/bundle
|
|
17
16
|
COVERALLS_PARALLEL: true
|
|
18
17
|
EAGER_LOAD: 'true'
|
|
19
18
|
steps:
|
|
20
19
|
- checkout
|
|
21
|
-
- restore_cache:
|
|
22
|
-
keys:
|
|
23
|
-
- v2.0-<< parameters.gemfile >>-<< parameters.ruby-version >>
|
|
24
20
|
- run: gem install bundler -v '1.17'
|
|
25
21
|
- run:
|
|
26
22
|
name: Install dependencies
|
|
27
23
|
command: bundle install
|
|
28
|
-
- save_cache:
|
|
29
|
-
key: v2.0-<< parameters.gemfile >>-<< parameters.ruby-version >>
|
|
30
|
-
paths:
|
|
31
|
-
- vendor/bundle
|
|
32
24
|
- run:
|
|
33
25
|
name: Run Specs
|
|
34
26
|
command:
|
|
@@ -47,7 +39,6 @@ workflows:
|
|
|
47
39
|
matrix:
|
|
48
40
|
parameters:
|
|
49
41
|
ruby-version:
|
|
50
|
-
- '2.4'
|
|
51
42
|
- '2.5'
|
|
52
43
|
- '2.6'
|
|
53
44
|
- '2.7'
|
|
@@ -73,6 +64,7 @@ workflows:
|
|
|
73
64
|
- gemfiles/rails7.0_graphql1.12.gemfile
|
|
74
65
|
- gemfiles/rails7.0_graphql1.13.gemfile
|
|
75
66
|
- gemfiles/rails7.0_graphql2.0.gemfile
|
|
67
|
+
- gemfiles/rails7.0_graphql2.1.gemfile
|
|
76
68
|
exclude:
|
|
77
69
|
- ruby-version: '2.4'
|
|
78
70
|
gemfile: gemfiles/rails6.0_graphql1.11.gemfile
|
|
@@ -96,6 +88,8 @@ workflows:
|
|
|
96
88
|
gemfile: gemfiles/rails7.0_graphql1.13.gemfile
|
|
97
89
|
- ruby-version: '2.4'
|
|
98
90
|
gemfile: gemfiles/rails7.0_graphql2.0.gemfile
|
|
91
|
+
- ruby-version: '2.4'
|
|
92
|
+
gemfile: gemfiles/rails7.0_graphql2.1.gemfile
|
|
99
93
|
- ruby-version: '2.5'
|
|
100
94
|
gemfile: gemfiles/rails7.0_graphql1.11.gemfile
|
|
101
95
|
- ruby-version: '2.5'
|
|
@@ -108,6 +102,18 @@ workflows:
|
|
|
108
102
|
gemfile: gemfiles/rails7.0_graphql1.13.gemfile
|
|
109
103
|
- ruby-version: '2.5'
|
|
110
104
|
gemfile: gemfiles/rails7.0_graphql2.0.gemfile
|
|
105
|
+
- ruby-version: '2.5'
|
|
106
|
+
gemfile: gemfiles/rails7.0_graphql2.1.gemfile
|
|
107
|
+
- ruby-version: '2.5'
|
|
108
|
+
gemfile: gemfiles/rails6.1_graphql2.0.gemfile
|
|
109
|
+
- ruby-version: '2.5'
|
|
110
|
+
gemfile: gemfiles/rails6.1_graphql1.12.gemfile
|
|
111
|
+
- ruby-version: '2.5'
|
|
112
|
+
gemfile: gemfiles/rails6.1_graphql1.11.gemfile
|
|
113
|
+
- ruby-version: '2.5'
|
|
114
|
+
gemfile: gemfiles/rails6.0_graphql1.12.gemfile
|
|
115
|
+
- ruby-version: '2.5'
|
|
116
|
+
gemfile: gemfiles/rails6.0_graphql1.11.gemfile
|
|
111
117
|
- ruby-version: '2.6'
|
|
112
118
|
gemfile: gemfiles/rails7.0_graphql1.11.gemfile
|
|
113
119
|
- ruby-version: '2.6'
|
|
@@ -116,6 +122,8 @@ workflows:
|
|
|
116
122
|
gemfile: gemfiles/rails7.0_graphql1.13.gemfile
|
|
117
123
|
- ruby-version: '2.6'
|
|
118
124
|
gemfile: gemfiles/rails7.0_graphql2.0.gemfile
|
|
125
|
+
- ruby-version: '2.6'
|
|
126
|
+
gemfile: gemfiles/rails7.0_graphql2.1.gemfile
|
|
119
127
|
- ruby-version: '2.7'
|
|
120
128
|
gemfile: gemfiles/rails4.2_graphql1.8.gemfile
|
|
121
129
|
- ruby-version: '3.0'
|
data/.rubocop.yml
CHANGED
data/Appraisals
CHANGED
|
@@ -83,63 +83,68 @@ appraise 'rails5.2-graphql1.12' do
|
|
|
83
83
|
end
|
|
84
84
|
|
|
85
85
|
appraise 'rails6.0-graphql1.10' do
|
|
86
|
-
gem 'sqlite3', '~> 1.4'
|
|
86
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
87
87
|
gem 'devise', '>= 4.7'
|
|
88
88
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '6-0-stable'
|
|
89
89
|
gem 'graphql', '~> 1.10.0'
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
appraise 'rails6.0-graphql1.11' do
|
|
93
|
-
gem 'sqlite3', '~> 1.4'
|
|
93
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
94
|
+
gem 'public_suffix', '< 5'
|
|
94
95
|
gem 'devise', '>= 4.7'
|
|
95
96
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '6-0-stable'
|
|
96
97
|
gem 'graphql', '~> 1.11.0'
|
|
97
98
|
end
|
|
98
99
|
|
|
99
100
|
appraise 'rails6.0-graphql1.12' do
|
|
100
|
-
gem 'sqlite3', '~> 1.4'
|
|
101
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
102
|
+
gem 'public_suffix', '< 5'
|
|
101
103
|
gem 'devise', '>= 4.7'
|
|
102
104
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '6-0-stable'
|
|
103
105
|
gem 'graphql', '~> 1.12.0'
|
|
104
106
|
end
|
|
105
107
|
|
|
106
108
|
appraise 'rails6.0-graphql1.13' do
|
|
107
|
-
gem 'sqlite3', '~> 1.4'
|
|
109
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
108
110
|
gem 'devise', '>= 4.7'
|
|
109
111
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '6-0-stable'
|
|
110
112
|
gem 'graphql', '~> 1.13.0'
|
|
111
113
|
end
|
|
112
114
|
|
|
113
115
|
appraise 'rails6.1-graphql1.10' do
|
|
114
|
-
gem 'sqlite3', '~> 1.4'
|
|
116
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
115
117
|
gem 'devise', '>= 4.7'
|
|
116
118
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '6-1-stable'
|
|
117
119
|
gem 'graphql', '~> 1.10.0'
|
|
118
120
|
end
|
|
119
121
|
|
|
120
122
|
appraise 'rails6.1-graphql1.11' do
|
|
121
|
-
gem 'sqlite3', '~> 1.4'
|
|
123
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
124
|
+
gem 'public_suffix', '< 5'
|
|
122
125
|
gem 'devise', '>= 4.7'
|
|
123
126
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '6-1-stable'
|
|
124
127
|
gem 'graphql', '~> 1.11.0'
|
|
125
128
|
end
|
|
126
129
|
|
|
127
130
|
appraise 'rails6.1-graphql1.12' do
|
|
128
|
-
gem 'sqlite3', '~> 1.4'
|
|
131
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
132
|
+
gem 'public_suffix', '< 5'
|
|
129
133
|
gem 'devise', '>= 4.7'
|
|
130
134
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '6-1-stable'
|
|
131
135
|
gem 'graphql', '~> 1.12.0'
|
|
132
136
|
end
|
|
133
137
|
|
|
134
138
|
appraise 'rails6.1-graphql1.13' do
|
|
135
|
-
gem 'sqlite3', '~> 1.4'
|
|
139
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
136
140
|
gem 'devise', '>= 4.7'
|
|
137
141
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '6-1-stable'
|
|
138
142
|
gem 'graphql', '~> 1.13.0'
|
|
139
143
|
end
|
|
140
144
|
|
|
141
145
|
appraise 'rails6.1-graphql2.0' do
|
|
142
|
-
gem '
|
|
146
|
+
gem 'public_suffix', '< 5'
|
|
147
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
143
148
|
gem 'devise', '>= 4.7'
|
|
144
149
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '6-1-stable'
|
|
145
150
|
gem 'graphql', '~> 2.0.1'
|
|
@@ -147,7 +152,7 @@ end
|
|
|
147
152
|
|
|
148
153
|
appraise 'rails7.0-graphql1.11' do
|
|
149
154
|
gem 'sassc-rails'
|
|
150
|
-
gem 'sqlite3', '~> 1.4'
|
|
155
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
151
156
|
gem 'devise', '>= 4.7'
|
|
152
157
|
gem 'devise_token_auth', '>= 1.2.1'
|
|
153
158
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '7-0-stable'
|
|
@@ -156,7 +161,7 @@ end
|
|
|
156
161
|
|
|
157
162
|
appraise 'rails7.0-graphql1.12' do
|
|
158
163
|
gem 'sassc-rails'
|
|
159
|
-
gem 'sqlite3', '~> 1.4'
|
|
164
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
160
165
|
gem 'devise', '>= 4.7'
|
|
161
166
|
gem 'devise_token_auth', '>= 1.2.1'
|
|
162
167
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '7-0-stable'
|
|
@@ -165,7 +170,7 @@ end
|
|
|
165
170
|
|
|
166
171
|
appraise 'rails7.0-graphql1.13' do
|
|
167
172
|
gem 'sassc-rails'
|
|
168
|
-
gem 'sqlite3', '~> 1.4'
|
|
173
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
169
174
|
gem 'devise', '>= 4.7'
|
|
170
175
|
gem 'devise_token_auth', '>= 1.2.1'
|
|
171
176
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '7-0-stable'
|
|
@@ -174,9 +179,18 @@ end
|
|
|
174
179
|
|
|
175
180
|
appraise 'rails7.0-graphql2.0' do
|
|
176
181
|
gem 'sassc-rails'
|
|
177
|
-
gem 'sqlite3', '~> 1.4'
|
|
182
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
178
183
|
gem 'devise_token_auth', '>= 1.2.1'
|
|
179
184
|
gem 'devise', '>= 4.7'
|
|
180
185
|
gem 'rails', git: 'https://github.com/rails/rails', branch: '7-0-stable'
|
|
181
186
|
gem 'graphql', '~> 2.0.1'
|
|
182
187
|
end
|
|
188
|
+
|
|
189
|
+
appraise 'rails7.0-graphql2.1' do
|
|
190
|
+
gem 'sassc-rails'
|
|
191
|
+
gem 'sqlite3', '~> 1.5.4'
|
|
192
|
+
gem 'devise_token_auth', '>= 1.2.1'
|
|
193
|
+
gem 'devise', '>= 4.7'
|
|
194
|
+
gem 'rails', git: 'https://github.com/rails/rails', branch: '7-0-stable'
|
|
195
|
+
gem 'graphql', '>= 2.1', '< 2.2'
|
|
196
|
+
end
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [v1.3.0](https://github.com/graphql-devise/graphql_devise/tree/v1.3.0) (2023-09-01)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v1.2.0...v1.3.0)
|
|
6
|
+
|
|
7
|
+
**Implemented enhancements:**
|
|
8
|
+
|
|
9
|
+
- Support graphql v2.1 [\#257](https://github.com/graphql-devise/graphql_devise/pull/257) ([mcelicalderon](https://github.com/mcelicalderon))
|
|
10
|
+
|
|
11
|
+
## [v1.2.0](https://github.com/graphql-devise/graphql_devise/tree/v1.2.0) (2022-11-21)
|
|
12
|
+
|
|
13
|
+
[Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v1.1.1...v1.2.0)
|
|
14
|
+
|
|
15
|
+
**Implemented enhancements:**
|
|
16
|
+
|
|
17
|
+
- Set base controller from route mount [\#237](https://github.com/graphql-devise/graphql_devise/pull/237) ([00dav00](https://github.com/00dav00))
|
|
18
|
+
|
|
3
19
|
## [v1.1.1](https://github.com/graphql-devise/graphql_devise/tree/v1.1.1) (2022-10-20)
|
|
4
20
|
|
|
5
21
|
[Full Changelog](https://github.com/graphql-devise/graphql_devise/compare/v1.1.0...v1.1.1)
|
data/README.md
CHANGED
|
@@ -157,6 +157,8 @@ Rails.application.routes.draw do
|
|
|
157
157
|
login: Mutations::Login
|
|
158
158
|
},
|
|
159
159
|
skip: [:register],
|
|
160
|
+
# optional, use only if you need a specific base controller to mount the new actions
|
|
161
|
+
base_controller: ApiController,
|
|
160
162
|
additional_mutations: {
|
|
161
163
|
# generates mutation { adminUserSignUp }
|
|
162
164
|
admin_user_sign_up: Mutations::AdminUserSignUp
|
|
@@ -264,6 +266,11 @@ our default classes and yielding your customized code after calling `super`, exa
|
|
|
264
266
|
and an `authenticatable` type to every query. Gem will try to use `Types::<model>Type` by
|
|
265
267
|
default, so in our example you could define `Types::UserType` and every query and mutation
|
|
266
268
|
will use it. But, you can override this type with this option like in the example.
|
|
269
|
+
1. `base_controller`: Specifying this is optional. By default the controller used to mount the route is
|
|
270
|
+
`GraphqlDevise::ApplicationController` which inherits from `ActionController::API` or `ActionController::Base`
|
|
271
|
+
depending on the rails version of the main project. This option allows you to set the controller used as the parent of
|
|
272
|
+
the controller where the route will be mounted. This config is similar to `Devise`'s `base_controller` config but in
|
|
273
|
+
this case each route can have a different parent controller. **This option only works if you are using the mount method.**
|
|
267
274
|
1. `skip`: An array of the operations that should not be available in the authentication schema. All these operations are
|
|
268
275
|
symbols and should belong to the list of available operations in the gem.
|
|
269
276
|
1. `only`: An array of the operations that should be available in the authentication schema. The `skip` and `only` options are
|
|
@@ -5,48 +5,6 @@ require_dependency 'graphql_devise/application_controller'
|
|
|
5
5
|
module GraphqlDevise
|
|
6
6
|
class GraphqlController < ApplicationController
|
|
7
7
|
include SetUserByToken
|
|
8
|
-
|
|
9
|
-
def auth
|
|
10
|
-
result = if params[:_json]
|
|
11
|
-
Schema.multiplex(
|
|
12
|
-
params[:_json].map do |param|
|
|
13
|
-
{ query: param[:query] }.merge(execute_params(param))
|
|
14
|
-
end
|
|
15
|
-
)
|
|
16
|
-
else
|
|
17
|
-
Schema.execute(params[:query], **execute_params(params))
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
render json: result unless performed?
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
attr_accessor :client_id, :token, :resource
|
|
24
|
-
|
|
25
|
-
private
|
|
26
|
-
|
|
27
|
-
def execute_params(item)
|
|
28
|
-
{
|
|
29
|
-
operation_name: item[:operationName],
|
|
30
|
-
variables: ensure_hash(item[:variables]),
|
|
31
|
-
context: { controller: self }
|
|
32
|
-
}
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def ensure_hash(ambiguous_param)
|
|
36
|
-
case ambiguous_param
|
|
37
|
-
when String
|
|
38
|
-
if ambiguous_param.present?
|
|
39
|
-
ensure_hash(JSON.parse(ambiguous_param))
|
|
40
|
-
else
|
|
41
|
-
{}
|
|
42
|
-
end
|
|
43
|
-
when Hash, ActionController::Parameters
|
|
44
|
-
ambiguous_param
|
|
45
|
-
when nil
|
|
46
|
-
{}
|
|
47
|
-
else
|
|
48
|
-
raise ArgumentError, "Unexpected parameter: #{ambiguous_param}"
|
|
49
|
-
end
|
|
50
|
-
end
|
|
8
|
+
include AuthControllerMethods
|
|
51
9
|
end
|
|
52
10
|
end
|
data/graphql_devise.gemspec
CHANGED
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
|
28
28
|
spec.required_ruby_version = '>= 2.4.4'
|
|
29
29
|
|
|
30
30
|
spec.add_dependency 'devise_token_auth', '>= 0.1.43', '< 2.0'
|
|
31
|
-
spec.add_dependency 'graphql', '>= 1.8', '< 2.
|
|
31
|
+
spec.add_dependency 'graphql', '>= 1.8', '< 2.2'
|
|
32
32
|
spec.add_dependency 'rails', '>= 4.2', '< 7.1'
|
|
33
33
|
spec.add_dependency 'zeitwerk'
|
|
34
34
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GraphqlDevise
|
|
4
|
+
module AuthControllerMethods
|
|
5
|
+
extend ActiveSupport::Concern
|
|
6
|
+
|
|
7
|
+
def auth
|
|
8
|
+
result = if params[:_json]
|
|
9
|
+
Schema.multiplex(
|
|
10
|
+
params[:_json].map do |param|
|
|
11
|
+
{ query: param[:query] }.merge(execute_params(param))
|
|
12
|
+
end
|
|
13
|
+
)
|
|
14
|
+
else
|
|
15
|
+
Schema.execute(params[:query], **execute_params(params))
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
render json: result unless performed?
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
attr_accessor :client_id, :token, :resource
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def execute_params(item)
|
|
26
|
+
{
|
|
27
|
+
operation_name: item[:operationName],
|
|
28
|
+
variables: ensure_hash(item[:variables]),
|
|
29
|
+
context: { controller: self }
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def ensure_hash(ambiguous_param)
|
|
34
|
+
case ambiguous_param
|
|
35
|
+
when String
|
|
36
|
+
if ambiguous_param.present?
|
|
37
|
+
ensure_hash(JSON.parse(ambiguous_param))
|
|
38
|
+
else
|
|
39
|
+
{}
|
|
40
|
+
end
|
|
41
|
+
when Hash, ActionController::Parameters
|
|
42
|
+
ambiguous_param
|
|
43
|
+
when nil
|
|
44
|
+
{}
|
|
45
|
+
else
|
|
46
|
+
raise ArgumentError, "Unexpected parameter: #{ambiguous_param}"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
module GraphqlDevise
|
|
2
2
|
module RouteMounter
|
|
3
3
|
def mount_graphql_devise_for(resource, options = {})
|
|
4
|
+
routing = 'graphql_devise/graphql#auth'
|
|
5
|
+
|
|
6
|
+
if (base_controller = options.delete(:base_controller))
|
|
7
|
+
new_controller = GraphqlDevise.const_set("#{resource}AuthController", Class.new(base_controller))
|
|
8
|
+
new_controller.include(SetUserByToken)
|
|
9
|
+
new_controller.include(AuthControllerMethods)
|
|
10
|
+
|
|
11
|
+
routing = "#{new_controller.to_s.underscore.gsub('_controller','')}#auth"
|
|
12
|
+
end
|
|
13
|
+
|
|
4
14
|
clean_options = ResourceLoader.new(resource, options, true).call(
|
|
5
15
|
Types::QueryType,
|
|
6
16
|
Types::MutationType
|
|
7
17
|
)
|
|
8
18
|
|
|
9
|
-
post clean_options.at, to:
|
|
10
|
-
get clean_options.at, to:
|
|
19
|
+
post clean_options.at, to: routing
|
|
20
|
+
get clean_options.at, to: routing
|
|
11
21
|
end
|
|
12
22
|
end
|
|
13
23
|
end
|
data/spec/dummy/config/routes.rb
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
Rails.application.routes.draw do
|
|
4
|
-
mount_graphql_devise_for
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
public_user: Resolvers::PublicUser
|
|
11
|
-
|
|
4
|
+
mount_graphql_devise_for(
|
|
5
|
+
User,
|
|
6
|
+
at: '/api/v1/graphql_auth',
|
|
7
|
+
base_controller: CookiesController,
|
|
8
|
+
operations: { login: Mutations::Login, register: Mutations::Register },
|
|
9
|
+
additional_mutations: { register_confirmed_user: Mutations::RegisterConfirmedUser },
|
|
10
|
+
additional_queries: { public_user: Resolvers::PublicUser }
|
|
11
|
+
)
|
|
12
12
|
|
|
13
13
|
mount_graphql_devise_for(
|
|
14
14
|
Admin,
|
|
@@ -185,23 +185,22 @@ RSpec.describe 'Login Requests' do
|
|
|
185
185
|
end
|
|
186
186
|
end
|
|
187
187
|
|
|
188
|
-
|
|
189
188
|
if DeviseTokenAuth.respond_to?(:cookie_enabled)
|
|
190
189
|
context 'when using cookies for auth' do
|
|
191
190
|
let!(:user) { create(:user, :confirmed, password: password, email: 'vvega@wallaceinc.com') }
|
|
192
191
|
let(:email) { user.email }
|
|
193
192
|
let(:query) do
|
|
194
193
|
<<-GRAPHQL
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
194
|
+
mutation {
|
|
195
|
+
userLogin(
|
|
196
|
+
email: "#{email}",
|
|
197
|
+
password: "#{password}"
|
|
198
|
+
) {
|
|
199
|
+
authenticatable { email }
|
|
200
|
+
credentials { accessToken uid tokenType client expiry }
|
|
201
|
+
}
|
|
202
202
|
}
|
|
203
|
-
|
|
204
|
-
GRAPHQL
|
|
203
|
+
GRAPHQL
|
|
205
204
|
end
|
|
206
205
|
|
|
207
206
|
around do |example|
|
|
@@ -214,7 +213,7 @@ RSpec.describe 'Login Requests' do
|
|
|
214
213
|
|
|
215
214
|
it 'honors DTA configuration of setting auth info in cookies' do
|
|
216
215
|
cookie = cookies.get_cookie('auth_cookie')
|
|
217
|
-
expect(JSON.parse(cookie.value).keys).to include(
|
|
216
|
+
expect(JSON.parse(cookie.value).keys).to include('uid', 'access-token', 'client')
|
|
218
217
|
end
|
|
219
218
|
end
|
|
220
219
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: graphql_devise
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mario Celi
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: exe
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2023-09-01 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: devise_token_auth
|
|
@@ -40,7 +40,7 @@ dependencies:
|
|
|
40
40
|
version: '1.8'
|
|
41
41
|
- - "<"
|
|
42
42
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: '2.
|
|
43
|
+
version: '2.2'
|
|
44
44
|
type: :runtime
|
|
45
45
|
prerelease: false
|
|
46
46
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -50,7 +50,7 @@ dependencies:
|
|
|
50
50
|
version: '1.8'
|
|
51
51
|
- - "<"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: '2.
|
|
53
|
+
version: '2.2'
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: rails
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -333,6 +333,7 @@ files:
|
|
|
333
333
|
- lib/graphql_devise.rb
|
|
334
334
|
- lib/graphql_devise/concerns/additional_controller_methods.rb
|
|
335
335
|
- lib/graphql_devise/concerns/additional_model_methods.rb
|
|
336
|
+
- lib/graphql_devise/concerns/auth_controller_methods.rb
|
|
336
337
|
- lib/graphql_devise/concerns/authenticatable.rb
|
|
337
338
|
- lib/graphql_devise/concerns/controller_methods.rb
|
|
338
339
|
- lib/graphql_devise/concerns/field_authentication.rb
|
|
@@ -389,6 +390,7 @@ files:
|
|
|
389
390
|
- spec/dummy/app/assets/config/manifest.js
|
|
390
391
|
- spec/dummy/app/controllers/api/v1/graphql_controller.rb
|
|
391
392
|
- spec/dummy/app/controllers/application_controller.rb
|
|
393
|
+
- spec/dummy/app/controllers/cookies_controller.rb
|
|
392
394
|
- spec/dummy/app/graphql/dummy_schema.rb
|
|
393
395
|
- spec/dummy/app/graphql/interpreter_schema.rb
|
|
394
396
|
- spec/dummy/app/graphql/mutations/base_mutation.rb
|
|
@@ -526,7 +528,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
526
528
|
- !ruby/object:Gem::Version
|
|
527
529
|
version: '0'
|
|
528
530
|
requirements: []
|
|
529
|
-
rubygems_version: 3.
|
|
531
|
+
rubygems_version: 3.4.19
|
|
530
532
|
signing_key:
|
|
531
533
|
specification_version: 4
|
|
532
534
|
summary: GraphQL queries and mutations on top of devise_token_auth
|
|
@@ -536,6 +538,7 @@ test_files:
|
|
|
536
538
|
- spec/dummy/app/assets/config/manifest.js
|
|
537
539
|
- spec/dummy/app/controllers/api/v1/graphql_controller.rb
|
|
538
540
|
- spec/dummy/app/controllers/application_controller.rb
|
|
541
|
+
- spec/dummy/app/controllers/cookies_controller.rb
|
|
539
542
|
- spec/dummy/app/graphql/dummy_schema.rb
|
|
540
543
|
- spec/dummy/app/graphql/interpreter_schema.rb
|
|
541
544
|
- spec/dummy/app/graphql/mutations/base_mutation.rb
|