its-ruby-auth 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +28 -0
  4. data/Rakefile +7 -0
  5. data/app/controllers/ibrain/social_callbacks_controller.rb +58 -0
  6. data/app/graphql/ibrain/mutations/auth_mutation.rb +218 -0
  7. data/app/graphql/ibrain/mutations/generate_firebase_token_mutation.rb +35 -0
  8. data/app/graphql/ibrain/mutations/sign_in_mutation.rb +74 -0
  9. data/app/graphql/ibrain/mutations/sign_out_mutation.rb +16 -0
  10. data/app/graphql/ibrain/mutations/sign_up_mutation.rb +61 -0
  11. data/app/graphql/ibrain/mutations/social_sign_in_mutation.rb +71 -0
  12. data/app/graphql/ibrain/types/input/generate_firebase_token_input.rb +13 -0
  13. data/app/graphql/ibrain/types/input/sign_in_input.rb +12 -0
  14. data/app/graphql/ibrain/types/input/sign_up_input.rb +17 -0
  15. data/app/graphql/ibrain/types/input/social_login_input.rb +11 -0
  16. data/app/graphql/ibrain/types/input/social_sign_in_input.rb +11 -0
  17. data/app/models/ibrain/user.rb +88 -0
  18. data/app/repositories/apple_repository.rb +17 -0
  19. data/app/repositories/auth_repository.rb +102 -0
  20. data/app/repositories/firebase_repository.rb +69 -0
  21. data/app/repositories/line_repository.rb +57 -0
  22. data/config/initializers/devise.rb +314 -0
  23. data/config/initializers/ibrain_jwt_expiration.rb +9 -0
  24. data/config/locales/en.yml +17 -0
  25. data/config/locales/ja.yml +17 -0
  26. data/config/locales/vi.yml +17 -0
  27. data/config/routes.rb +20 -0
  28. data/lib/controllers/ibrain/user_confirmations_controller.rb +30 -0
  29. data/lib/controllers/ibrain/user_passwords_controller.rb +34 -0
  30. data/lib/controllers/ibrain/user_registrations_controller.rb +75 -0
  31. data/lib/controllers/ibrain/user_sessions_controller.rb +58 -0
  32. data/lib/controllers/ibrain/user_unlocks_controller.rb +30 -0
  33. data/lib/generators/ibrain/auth/install/install_generator.rb +34 -0
  34. data/lib/generators/ibrain/auth/install/templates/config/initializers/devise.rb.tt +311 -0
  35. data/lib/generators/ibrain/auth/install/templates/config/initializers/ibrain_auth.rb.tt +43 -0
  36. data/lib/generators/ibrain/auth/install/templates/config/initializers/ibrain_jwt.rb.tt +13 -0
  37. data/lib/generators/ibrain/auth/install/templates/config/initializers/omniauth.rb.tt +25 -0
  38. data/lib/generators/ibrain/auth/install/templates/db/schemas/users_migrate.erb +39 -0
  39. data/lib/generators/ibrain/auth/install/templates/db/schemas/users_schema.erb +37 -0
  40. data/lib/ibrain/auth/devise.rb +16 -0
  41. data/lib/ibrain/auth/engine.rb +42 -0
  42. data/lib/ibrain/auth/failure_app.rb +27 -0
  43. data/lib/ibrain/auth/version.rb +17 -0
  44. data/lib/ibrain/auth.rb +17 -0
  45. data/lib/ibrain/auth_configuration.rb +45 -0
  46. data/lib/ibrain/authentication_helpers.rb +13 -0
  47. data/lib/ibrain_auth.rb +9 -0
  48. data/lib/tasks/ibrain/auth_tasks.rake +5 -0
  49. metadata +287 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a2d670bdf42a04cb6b6b9928917281e084b4b2ef13f291efffa60dc7531fe686
4
+ data.tar.gz: a500635f8e9e46767a332bb283b9176f6c64813274148126f72d36e242ac1829
5
+ SHA512:
6
+ metadata.gz: f8e5f05820d44873bca31f056b60336d84f8ca93cfc481f8e0ca89d4950f3bcd99d308b5bd25e24f9fb03c5ec5d6debadd95b7c152fb154b390c293b64a7e841
7
+ data.tar.gz: f24402f2ebc10bab4dd75e4c4e5d5d61295bda7abf8d3d30ab699c1e97d4d130d3356b70a3f30c64497b538e676c6405593931665cbc3db24221c77c1539db5f
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2021 TODO: Write your name
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # Ibrain::Auth
2
+ Short description and motivation.
3
+
4
+ ## Usage
5
+ How to use my plugin.
6
+
7
+ ## Installation
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'ibrain-auth'
12
+ ```
13
+
14
+ And then execute:
15
+ ```bash
16
+ $ bundle
17
+ ```
18
+
19
+ Or install it yourself as:
20
+ ```bash
21
+ $ gem install ibrain-auth
22
+ ```
23
+
24
+ ## Contributing
25
+ Contribution directions go here.
26
+
27
+ ## License
28
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/setup'
4
+
5
+ load 'rails/tasks/statistics.rake'
6
+
7
+ require 'bundler/gem_tasks'
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Ibrain::SocialCallbacksController < Devise::OmniauthCallbacksController
4
+ include ActionController::Helpers
5
+ include Ibrain::Core::ControllerHelpers::Response
6
+ include ActionController::MimeResponds
7
+
8
+ def instagram
9
+ generic_callback( 'instagram' )
10
+ end
11
+
12
+ def facebook
13
+ generic_callback( 'facebook' )
14
+ end
15
+
16
+ def twitter
17
+ generic_callback( 'twitter' )
18
+ end
19
+
20
+ def google_oauth2
21
+ generic_callback( 'google_oauth2' )
22
+ end
23
+
24
+ def apple
25
+ generic_callback( 'apple' )
26
+ end
27
+
28
+ def line
29
+ generic_callback( 'line' )
30
+ end
31
+
32
+ def create
33
+ user = line_repo.find_or_initialize!
34
+
35
+ render_json_ok(user, nil)
36
+ end
37
+
38
+ def new_user_session(*args)
39
+ new_session(*args)
40
+ end
41
+
42
+ private
43
+
44
+ def repo
45
+ AuthRepository.new(resource, params)
46
+ end
47
+
48
+ def line_repo
49
+ LineRepository.new(resource, request.env['omniauth.auth'])
50
+ end
51
+
52
+ def apple_repo
53
+ AppleRepository.new(resource, request.env['omniauth.auth'])
54
+ end
55
+
56
+ def generic_callback( provider )
57
+ end
58
+ end
@@ -0,0 +1,218 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain::Mutations
4
+ class AuthMutation < Ibrain::Mutations::BaseMutation
5
+ include ActionController::Helpers
6
+ include Devise::Controllers::ScopedViews
7
+ include Devise::Controllers::Helpers
8
+
9
+ helpers = %w(resource scope_name resource_name signed_in_resource
10
+ resource_class resource_params devise_mapping)
11
+
12
+ helper_method(*helpers)
13
+
14
+ def ready?(args)
15
+ @params = ActionController::Parameters.new(
16
+ args.to_h.with_indifferent_access.transform_keys(&:underscore)
17
+ )
18
+
19
+ @auth_resource = load_resource
20
+ true
21
+ end
22
+
23
+ # Override prefixes to consider the scoped view.
24
+ # Notice we need to check for the request due to a bug in
25
+ # Action Controller tests that forces _prefixes to be
26
+ # loaded before even having a request object.
27
+ #
28
+ # This method should be public as it is in ActionPack
29
+ # itself. Changing its visibility may break other gems.
30
+ def _prefixes # :nodoc:
31
+ @_prefixes ||= if self.class.scoped_views? && request && devise_mapping
32
+ ["#{devise_mapping.scoped_path}/#{controller_name}"] + super
33
+ else
34
+ super
35
+ end
36
+ end
37
+
38
+ protected
39
+
40
+ attr_reader :auth_resource
41
+
42
+ def auth_headers(headers, user, scope: nil, aud: nil)
43
+ scope ||= Devise::Mapping.find_scope!(user)
44
+ aud ||= headers[Warden::JWTAuth.config.aud_header]
45
+
46
+ token, payload = Warden::JWTAuth::UserEncoder.new.call(
47
+ user, scope, aud
48
+ )
49
+
50
+ [token, payload.try(:fetch, 'jti')]
51
+ rescue StandardError => e
52
+ Ibrain::Logger.error(e.message)
53
+
54
+ []
55
+ end
56
+
57
+ # Gets the actual resource stored in the instance variable
58
+ def resource
59
+ instance_variable_get(:"@#{resource_name}")
60
+ end
61
+
62
+ # Proxy to devise map name
63
+ def resource_name
64
+ devise_mapping.name
65
+ end
66
+ alias :scope_name :resource_name
67
+
68
+ # Proxy to devise map class
69
+ def resource_class
70
+ devise_mapping.to
71
+ end
72
+
73
+ # Returns a signed in resource from session (if one exists)
74
+ def signed_in_resource
75
+ warden.authenticate(scope: resource_name)
76
+ end
77
+
78
+ # Attempt to find the mapped route for devise based on request path
79
+ def devise_mapping
80
+ @devise_mapping ||= request.env["devise.mapping"]
81
+ end
82
+
83
+ # Returns real navigational formats which are supported by Rails
84
+ def navigational_formats
85
+ @navigational_formats ||= Devise.navigational_formats.select { |format| Mime::EXTENSION_LOOKUP[format.to_s] }
86
+ end
87
+
88
+ def unknown_action!(msg)
89
+ logger&.debug "[Devise] #{msg}"
90
+ raise AbstractController::ActionNotFound, msg
91
+ end
92
+
93
+ # Sets the resource creating an instance variable
94
+ def resource=(new_resource)
95
+ instance_variable_set(:"@#{resource_name}", new_resource)
96
+ end
97
+
98
+ # Helper for use in before_actions where no authentication is required.
99
+ #
100
+ # Example:
101
+ # before_action :require_no_authentication, only: :new
102
+ def require_no_authentication
103
+ assert_is_devise_resource!
104
+ return unless is_navigational_format?
105
+
106
+ no_input = devise_mapping.no_input_strategies
107
+
108
+ authenticated = if no_input.present?
109
+ args = no_input.dup.push scope: resource_name
110
+ warden.authenticate?(*args)
111
+ else
112
+ warden.authenticated?(resource_name)
113
+ end
114
+
115
+ if authenticated && resource = warden.user(resource_name)
116
+ set_flash_message(:alert, 'already_authenticated', scope: 'devise.failure')
117
+ redirect_to after_sign_in_path_for(resource)
118
+ end
119
+ end
120
+
121
+ # Helper for use after calling send_*_instructions methods on a resource.
122
+ # If we are in paranoid mode, we always act as if the resource was valid
123
+ # and instructions were sent.
124
+ def successfully_sent?(resource)
125
+ notice = if Devise.paranoid
126
+ resource.errors.clear
127
+ :send_paranoid_instructions
128
+ elsif resource.errors.empty?
129
+ :send_instructions
130
+ end
131
+
132
+ if notice
133
+ set_flash_message! :notice, notice
134
+ true
135
+ end
136
+ end
137
+
138
+ # Sets the flash message with :key, using I18n. By default you are able
139
+ # to set up your messages using specific resource scope, and if no message is
140
+ # found we look to the default scope. Set the "now" options key to a true
141
+ # value to populate the flash.now hash in lieu of the default flash hash (so
142
+ # the flash message will be available to the current action instead of the
143
+ # next action).
144
+ # Example (i18n locale file):
145
+ #
146
+ # en:
147
+ # devise:
148
+ # passwords:
149
+ # #default_scope_messages - only if resource_scope is not found
150
+ # user:
151
+ # #resource_scope_messages
152
+ #
153
+ # Please refer to README or en.yml locale file to check what messages are
154
+ # available.
155
+ def set_flash_message(key, kind, options = {})
156
+ message = find_message(kind, options)
157
+ if options[:now]
158
+ flash.now[key] = message if message.present?
159
+ elsif message.present?
160
+ flash[key] = message
161
+ end
162
+ end
163
+
164
+ # Sets flash message if is_flashing_format? equals true
165
+ def set_flash_message!(key, kind, options = {})
166
+ if is_flashing_format?
167
+ set_flash_message(key, kind, options)
168
+ end
169
+ end
170
+
171
+ # Sets minimum password length to show to user
172
+ def set_minimum_password_length
173
+ if devise_mapping.validatable?
174
+ @minimum_password_length = resource_class.password_length.min
175
+ end
176
+ end
177
+
178
+ def devise_i18n_options(options)
179
+ options
180
+ end
181
+
182
+ # Get message for given
183
+ def find_message(kind, options = {})
184
+ options[:scope] ||= translation_scope
185
+ options[:default] = Array(options[:default]).unshift(kind.to_sym)
186
+ options[:resource_name] = resource_name
187
+ options = devise_i18n_options(options)
188
+ I18n.t("#{options[:resource_name]}.#{kind}", **options)
189
+ end
190
+
191
+ # Controllers inheriting DeviseController are advised to override this
192
+ # method so that other controllers inheriting from them would use
193
+ # existing translations.
194
+ def translation_scope
195
+ "devise.#{controller_name}"
196
+ end
197
+
198
+ def clean_up_passwords(object)
199
+ object.clean_up_passwords if object.respond_to?(:clean_up_passwords)
200
+ end
201
+
202
+ def respond_with_navigational(*args, &block)
203
+ respond_with(*args) do |format|
204
+ format.any(*navigational_formats, &block)
205
+ end
206
+ end
207
+
208
+ def resource_params
209
+ params.fetch(resource_name, {})
210
+ end
211
+
212
+ def repo; end
213
+ def load_resource; end
214
+ def normalize_parameters; end
215
+
216
+ ActiveSupport.run_load_hooks(:devise_controller, self)
217
+ end
218
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain::Mutations
4
+ class GenerateFirebaseTokenMutation < AuthMutation
5
+ field :result, Boolean, null: true
6
+ field :token, String, null: true
7
+
8
+ argument :attributes, ::Ibrain::Types::Input::GenerateFirebaseTokenInput, required: true
9
+
10
+ def resolve(_args)
11
+ token = repo.generate_custom_token!
12
+
13
+ graphql_returning(token)
14
+ end
15
+
16
+ private
17
+
18
+ def normalize_parameters
19
+ attribute_params.permit(:code, :redirect_uri, :access_token)
20
+ rescue StandardError
21
+ ActionController::Parameters.new({})
22
+ end
23
+
24
+ def repo
25
+ ::FirebaseRepository.new(nil, normalize_parameters)
26
+ end
27
+
28
+ def graphql_returning(token)
29
+ OpenStruct.new(
30
+ token: token,
31
+ result: true
32
+ )
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain::Mutations
4
+ class SignInMutation < AuthMutation
5
+ field :user, Types::Objects::UserType, null: true
6
+ field :token, String, null: true
7
+ field :result, Boolean, null: true
8
+
9
+ argument :attributes, Ibrain::Auth::Config.sign_in_input, required: true
10
+ argument :device_token, String, description: 'Device token for notification', required: false
11
+
12
+ def resolve(_args)
13
+ raise ActionController::InvalidAuthenticityToken, I18n.t('ibrain.errors.account.incorrect') if auth_resource.blank?
14
+
15
+ if !auth_resource.try(:can_skip_confirmation?) && !auth_resource.try(:confirmed?)
16
+ raise ActionController::InvalidAuthenticityToken, I18n.t('ibrain.errors.account.not_verified')
17
+ end
18
+
19
+ auth_resource.skip_confirmation! unless auth_resource.try(:confirmed?)
20
+ sign_in(resource_name, auth_resource)
21
+ @current_user = warden.authenticate!(auth_options)
22
+
23
+ if !current_user.try(:is_activated?) && Ibrain::Config.is_require_activated_account
24
+ raise ActionController::InvalidAuthenticityToken, I18n.t('ibrain.errors.account.is_deactivated')
25
+ end
26
+
27
+ # warden.set_user(current_user)
28
+ current_user.jwt_token, jti = auth_headers(request, auth_resource)
29
+ current_user.jti = jti
30
+ current_user.save!
31
+
32
+ if params[:device_token].present?
33
+ device_token = current_user.device_tokens.find_by(token: params[:device_token])
34
+ current_user.device_tokens.create!({ token: params[:device_token] }) if device_token.blank?
35
+ end
36
+
37
+ context[:current_user] = current_user
38
+
39
+ graphql_returning(
40
+ user_signed_in?,
41
+ user_signed_in? ? current_user : nil,
42
+ current_user.try(:jwt_token)
43
+ )
44
+ end
45
+
46
+ private
47
+
48
+ def load_resource
49
+ repo.sign_in
50
+ end
51
+
52
+ def repo
53
+ ::AuthRepository.new(nil, normalize_parameters)
54
+ end
55
+
56
+ def normalize_parameters
57
+ attribute_params
58
+ rescue StandardError
59
+ ActionController::Parameters.new({})
60
+ end
61
+
62
+ def auth_options
63
+ { scope: resource_name }
64
+ end
65
+
66
+ def graphql_returning(result, user = nil, token = nil)
67
+ OpenStruct.new(
68
+ user: user,
69
+ token: token,
70
+ result: result
71
+ )
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain::Mutations
4
+ class SignOutMutation < AuthMutation
5
+ field :result, Boolean, null: true
6
+
7
+ def resolve
8
+ current_user.jti = nil
9
+ sign_out if current_user.save
10
+
11
+ current_user.device_tokens.delete_all unless user_signed_in?
12
+
13
+ OpenStruct.new(result: !user_signed_in?)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain::Mutations
4
+ class SignUpMutation < AuthMutation
5
+ field :is_verified, Boolean, null: true
6
+ field :result, Boolean, null: true
7
+
8
+ argument :attributes, Ibrain::Auth::Config.sign_up_input, required: true
9
+ argument :device_token, String, description: 'Device token for notificaiton', required: false
10
+
11
+ def resolve(_args)
12
+ # TODO: define logic inside repository
13
+ return graphql_returning(false, false) if auth_resource.blank?
14
+
15
+ sign_in(resource_name, auth_resource)
16
+ @current_user = warden.authenticate!(auth_options)
17
+
18
+ warden.set_user(current_user)
19
+ current_user.jwt_token, jti = auth_headers(request, auth_resource)
20
+
21
+ current_user.jti = jti
22
+ current_user.save!
23
+
24
+ if params[:device_token].present?
25
+ device_token = current_user.device_tokens.find_by(token: params[:device_token])
26
+
27
+ current_user.device_tokens.create!({ token: params[:device_token] }) if device_token.blank?
28
+ end
29
+
30
+ context[:current_user] = current_user
31
+ graphql_returning
32
+ end
33
+
34
+ private
35
+
36
+ def load_resource
37
+ repo.create
38
+ end
39
+
40
+ def repo
41
+ ::AuthRepository.new(nil, normalize_parameters)
42
+ end
43
+
44
+ def normalize_parameters
45
+ attribute_params
46
+ rescue StandardError
47
+ ActionController::Parameters.new({})
48
+ end
49
+
50
+ def auth_options
51
+ { scope: resource_name }
52
+ end
53
+
54
+ def graphql_returning
55
+ OpenStruct.new(
56
+ result: current_user.present?,
57
+ is_verified: false
58
+ )
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain::Mutations
4
+ class SocialSignInMutation < AuthMutation
5
+ field :user, Types::Objects::UserType, null: true
6
+ field :token, String, null: true
7
+ field :result, Boolean, null: true
8
+
9
+ argument :attributes, Ibrain::Auth::Config.social_sign_in_input, required: true
10
+ argument :device_token, String, description: 'Device token for notification', required: false
11
+
12
+ def resolve(_args)
13
+ return graphql_returning(false) if auth_resource.blank?
14
+
15
+ auth_resource.skip_confirmation! unless auth_resource.try(:confirmed?)
16
+ sign_in(resource_name, auth_resource)
17
+ @current_user = warden.authenticate!(auth_options)
18
+
19
+ if !current_user.try(:is_activated?) && Ibrain::Config.is_require_activated_account
20
+ raise ActionController::InvalidAuthenticityToken, I18n.t('ibrain.errors.account.is_deactivated')
21
+ end
22
+
23
+ # warden.set_user(current_user)
24
+ current_user.jwt_token, jti = auth_headers(request, auth_resource)
25
+ current_user.jti = jti
26
+ current_user.save!
27
+
28
+ if params[:device_token].present?
29
+ device_token = current_user.device_tokens.find_by(token: params[:device_token])
30
+
31
+ current_user.device_tokens.create!({ token: params[:device_token] }) if device_token.blank?
32
+ end
33
+
34
+ context[:current_user] = current_user
35
+
36
+ graphql_returning(
37
+ user_signed_in?,
38
+ user_signed_in? ? current_user : nil,
39
+ current_user.try(:jwt_token)
40
+ )
41
+ end
42
+
43
+ private
44
+
45
+ def load_resource
46
+ repo.sign_in
47
+ end
48
+
49
+ def repo
50
+ ::AuthRepository.new(nil, normalize_parameters)
51
+ end
52
+
53
+ def normalize_parameters
54
+ attribute_params
55
+ rescue StandardError
56
+ ActionController::Parameters.new({})
57
+ end
58
+
59
+ def auth_options
60
+ { scope: resource_name }
61
+ end
62
+
63
+ def graphql_returning(result, user = nil, token = nil)
64
+ OpenStruct.new(
65
+ user: user,
66
+ token: token,
67
+ result: result
68
+ )
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain
4
+ module Types
5
+ module Input
6
+ class GenerateFirebaseTokenInput < Ibrain::Types::BaseInputObject
7
+ argument :code, String, required: false
8
+ argument :redirect_uri, String, required: false
9
+ argument :access_token, String, required: false
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain
4
+ module Types
5
+ module Input
6
+ class SignInInput < Ibrain::Types::BaseInputObject
7
+ argument :username, String, required: true
8
+ argument :password, String, required: true
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain
4
+ module Types
5
+ module Input
6
+ class SignUpInput < Ibrain::Types::BaseInputObject
7
+ argument :first_name, String, required: false
8
+ argument :last_name, String, required: false
9
+ argument :email, String, required: false
10
+ argument :phone, String, required: false
11
+ argument :job_id, ID, required: false
12
+ argument :address, String, required: false
13
+ argument :password, String, required: false
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain
4
+ module Types
5
+ module Input
6
+ class SocialLoginInput < Ibrain::Types::BaseInputObject
7
+ argument :id_token, String, required: true
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ibrain
4
+ module Types
5
+ module Input
6
+ class SocialSignInInput < Ibrain::Types::BaseInputObject
7
+ argument :id_token, String, description: 'Id Token from firebase', required: true
8
+ end
9
+ end
10
+ end
11
+ end