ibrain-auth 0.1.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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +7 -0
- data/app/controllers/ibrain/auth/confirmations_controller.rb +30 -0
- data/app/controllers/ibrain/auth/passwords_controller.rb +34 -0
- data/app/controllers/ibrain/auth/registrations_controller.rb +75 -0
- data/app/controllers/ibrain/auth/sessions_controller.rb +44 -0
- data/app/controllers/ibrain/auth/unlocks_controller.rb +30 -0
- data/app/models/ibrain/auth/user.rb +24 -0
- data/app/repositories/auth_repository.rb +87 -0
- data/config/initializers/devise.rb +317 -0
- data/config/locales/en.yml +12 -0
- data/config/locales/jp.yml +12 -0
- data/config/locales/vi.yml +12 -0
- data/config/routes.rb +10 -0
- data/lib/generators/ibrain/auth/install/install_generator.rb +28 -0
- data/lib/generators/ibrain/auth/install/templates/config/initializers/devise.rb.tt +5 -0
- data/lib/generators/ibrain/auth/install/templates/config/initializers/ibrain_auth.rb.tt +10 -0
- data/lib/generators/ibrain/auth/install/templates/db/schemas/users_migrate.erb +39 -0
- data/lib/generators/ibrain/auth/install/templates/db/schemas/users_schema.erb +37 -0
- data/lib/ibrain/auth/devise.rb +16 -0
- data/lib/ibrain/auth/engine.rb +42 -0
- data/lib/ibrain/auth/version.rb +21 -0
- data/lib/ibrain/auth.rb +11 -0
- data/lib/ibrain/auth_configuration.rb +12 -0
- data/lib/ibrain/authentication_helpers.rb +13 -0
- data/lib/ibrain_auth.rb +3 -0
- data/lib/tasks/ibrain/auth_tasks.rake +5 -0
- metadata +176 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 74bd33792a6ef8724f03979a6e406af07449a8b72594133e682a96a51f140df1
|
4
|
+
data.tar.gz: 6558efe617aa2776df974f8b46a9586926ca72fbb7a089387a48c027f8959b3f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3a64ebd0360935fbe739cc3bfbebb850991252e35bbe8e81ca9b7a05627bab4b8e58b20ca08d13451533fa0eaa46bb59aeb03bdd8445c73ec6917795767b3d05
|
7
|
+
data.tar.gz: 0e33ffbb8ca3f23da1f0b266c15b576a6b3f27743259ad2b41be984d3de69ab0514556a5e1aed056c52803e851fa68086e020170eb6fea67f694105ba49373cc
|
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,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Ibrain::Auth::ConfirmationsController < Devise::ConfirmationsController
|
4
|
+
# GET /resource/confirmation/new
|
5
|
+
# def new
|
6
|
+
# super
|
7
|
+
# end
|
8
|
+
|
9
|
+
# POST /resource/confirmation
|
10
|
+
# def create
|
11
|
+
# super
|
12
|
+
# end
|
13
|
+
|
14
|
+
# GET /resource/confirmation?confirmation_token=abcdef
|
15
|
+
# def show
|
16
|
+
# super
|
17
|
+
# end
|
18
|
+
|
19
|
+
# protected
|
20
|
+
|
21
|
+
# The path used after resending confirmation instructions.
|
22
|
+
# def after_resending_confirmation_instructions_path_for(resource_name)
|
23
|
+
# super(resource_name)
|
24
|
+
# end
|
25
|
+
|
26
|
+
# The path used after confirmation.
|
27
|
+
# def after_confirmation_path_for(resource_name, resource)
|
28
|
+
# super(resource_name, resource)
|
29
|
+
# end
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Ibrain::Auth::PasswordsController < Devise::PasswordsController
|
4
|
+
# GET /resource/password/new
|
5
|
+
# def new
|
6
|
+
# super
|
7
|
+
# end
|
8
|
+
|
9
|
+
# POST /resource/password
|
10
|
+
# def create
|
11
|
+
# super
|
12
|
+
# end
|
13
|
+
|
14
|
+
# GET /resource/password/edit?reset_password_token=abcdef
|
15
|
+
# def edit
|
16
|
+
# super
|
17
|
+
# end
|
18
|
+
|
19
|
+
# PUT /resource/password
|
20
|
+
# def update
|
21
|
+
# super
|
22
|
+
# end
|
23
|
+
|
24
|
+
# protected
|
25
|
+
|
26
|
+
# def after_resetting_password_path_for(resource)
|
27
|
+
# super(resource)
|
28
|
+
# end
|
29
|
+
|
30
|
+
# The path used after sending reset password instructions
|
31
|
+
# def after_sending_reset_password_instructions_path_for(resource_name)
|
32
|
+
# super(resource_name)
|
33
|
+
# end
|
34
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Ibrain::Auth::RegistrationsController < Devise::RegistrationsController
|
4
|
+
# before_action :configure_sign_up_params, only: [:create]
|
5
|
+
# before_action :configure_account_update_params, only: [:update]
|
6
|
+
|
7
|
+
# GET /resource/sign_up
|
8
|
+
# def new
|
9
|
+
# super
|
10
|
+
# end
|
11
|
+
|
12
|
+
# POST /resource
|
13
|
+
def create
|
14
|
+
build_resource(sign_up_params)
|
15
|
+
|
16
|
+
user = repo.register(params)
|
17
|
+
sign_in(resource_name, user) if user.present?
|
18
|
+
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
# GET /resource/edit
|
23
|
+
# def edit
|
24
|
+
# super
|
25
|
+
# end
|
26
|
+
|
27
|
+
# PUT /resource
|
28
|
+
# def update
|
29
|
+
# super
|
30
|
+
# end
|
31
|
+
|
32
|
+
# DELETE /resource
|
33
|
+
# def destroy
|
34
|
+
# super
|
35
|
+
# end
|
36
|
+
|
37
|
+
# GET /resource/cancel
|
38
|
+
# Forces the session data which is usually expired after sign
|
39
|
+
# in to be expired now. This is useful if the user wants to
|
40
|
+
# cancel oauth signing in/up in the middle of the process,
|
41
|
+
# removing all OAuth session data.
|
42
|
+
# def cancel
|
43
|
+
# super
|
44
|
+
# end
|
45
|
+
|
46
|
+
# protected
|
47
|
+
|
48
|
+
# If you have extra params to permit, append them to the sanitizer.
|
49
|
+
# def configure_sign_up_params
|
50
|
+
# devise_parameter_sanitizer.permit(:sign_up, keys: [:attribute])
|
51
|
+
# end
|
52
|
+
|
53
|
+
# If you have extra params to permit, append them to the sanitizer.
|
54
|
+
# def configure_account_update_params
|
55
|
+
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
|
56
|
+
# end
|
57
|
+
|
58
|
+
# The path used after sign up.
|
59
|
+
# def after_sign_up_path_for(resource)
|
60
|
+
# super(resource)
|
61
|
+
# end
|
62
|
+
|
63
|
+
# The path used after sign up for inactive accounts.
|
64
|
+
# def after_inactive_sign_up_path_for(resource)
|
65
|
+
# super(resource)
|
66
|
+
# end
|
67
|
+
|
68
|
+
def sign_up_params
|
69
|
+
params.require(:auth).permit(Ibrain.user_class.permitted_attributes)
|
70
|
+
end
|
71
|
+
|
72
|
+
def repo
|
73
|
+
AuthRepository.new(resource)
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Ibrain::Auth::SessionsController < Devise::SessionsController
|
4
|
+
include ActionController::Helpers
|
5
|
+
include Ibrain::Core::ControllerHelpers::Response
|
6
|
+
include ActionController::MimeResponds
|
7
|
+
|
8
|
+
# before_action :configure_sign_in_params, only: [:create]
|
9
|
+
|
10
|
+
def create
|
11
|
+
user = repo.sign_in
|
12
|
+
sign_in(resource_name, user) if user.present?
|
13
|
+
|
14
|
+
super { |resource| @resource = resource }
|
15
|
+
end
|
16
|
+
|
17
|
+
# GET /resource/sign_in
|
18
|
+
# def new
|
19
|
+
# super
|
20
|
+
# end
|
21
|
+
|
22
|
+
# POST /resource/sign_in
|
23
|
+
# def create
|
24
|
+
# super
|
25
|
+
# end
|
26
|
+
|
27
|
+
# DELETE /resource/sign_out
|
28
|
+
# def destroy
|
29
|
+
# super
|
30
|
+
# end
|
31
|
+
|
32
|
+
# protected
|
33
|
+
|
34
|
+
# If you have extra params to permit, append them to the sanitizer.
|
35
|
+
# def configure_sign_in_params
|
36
|
+
# devise_parameter_sanitizer.permit(:sign_in, keys: [:attribute])
|
37
|
+
# end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def repo
|
42
|
+
AuthRepository.new(resource, params)
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Ibrain::Auth::UnlocksController < Devise::UnlocksController
|
4
|
+
# GET /resource/unlock/new
|
5
|
+
# def new
|
6
|
+
# super
|
7
|
+
# end
|
8
|
+
|
9
|
+
# POST /resource/unlock
|
10
|
+
# def create
|
11
|
+
# super
|
12
|
+
# end
|
13
|
+
|
14
|
+
# GET /resource/unlock?unlock_token=abcdef
|
15
|
+
# def show
|
16
|
+
# super
|
17
|
+
# end
|
18
|
+
|
19
|
+
# protected
|
20
|
+
|
21
|
+
# The path used after sending unlock password instructions
|
22
|
+
# def after_sending_unlock_instructions_path_for(resource)
|
23
|
+
# super(resource)
|
24
|
+
# end
|
25
|
+
|
26
|
+
# The path used after unlocking the resource
|
27
|
+
# def after_unlock_path_for(resource)
|
28
|
+
# super(resource)
|
29
|
+
# end
|
30
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ibrain
|
4
|
+
module Auth
|
5
|
+
class User < Ibrain::Base
|
6
|
+
include Devise::JWT::RevocationStrategies::JTIMatcher
|
7
|
+
|
8
|
+
devise :database_authenticatable, :registerable,
|
9
|
+
:recoverable, :validatable,
|
10
|
+
:jwt_authenticatable, jwt_revocation_strategy: self
|
11
|
+
|
12
|
+
def jwt_payload
|
13
|
+
# for hasura
|
14
|
+
hasura_keys = { 'https://hasura.io/jwt/claims': {
|
15
|
+
'x-hasura-allowed-roles': [role],
|
16
|
+
'x-hasura-default-role': role,
|
17
|
+
'x-hasura-user-id': id.to_s
|
18
|
+
} }
|
19
|
+
|
20
|
+
super.merge({ 'role' => role }, hasura_keys)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
ACCOUNT_COUMNS = %w[username email phone phone_number]
|
4
|
+
|
5
|
+
class AuthRepository < Ibrain::BaseRepository
|
6
|
+
def initialize(record, params)
|
7
|
+
super(nil, record)
|
8
|
+
|
9
|
+
@params = params
|
10
|
+
end
|
11
|
+
|
12
|
+
def create
|
13
|
+
user = sso_verify if normalize_params[:id_token].present?
|
14
|
+
|
15
|
+
if manual_params[:username].present?
|
16
|
+
query = available_columns.map do |column_name|
|
17
|
+
<<~RUBY
|
18
|
+
#{column_name} = '#{manual_params[:username]}'
|
19
|
+
RUBY
|
20
|
+
end.join('OR')
|
21
|
+
|
22
|
+
user = Ibrain.user_class.where(query).first
|
23
|
+
end
|
24
|
+
|
25
|
+
user.assign_attributes(normalize_params)
|
26
|
+
user.save
|
27
|
+
|
28
|
+
user
|
29
|
+
end
|
30
|
+
|
31
|
+
def sign_in
|
32
|
+
return sso_verify if normalize_params[:id_token].present?
|
33
|
+
|
34
|
+
user = Ibrain.user_class.where(
|
35
|
+
'username = ? or email = ?',
|
36
|
+
manual_params[:username],
|
37
|
+
manual_params[:username]
|
38
|
+
).first
|
39
|
+
|
40
|
+
return unless user.try(:valid_password?, manual_params[:password])
|
41
|
+
|
42
|
+
user
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
attr_reader :params
|
48
|
+
|
49
|
+
def firebase_url
|
50
|
+
"https://www.googleapis.com/identitytoolkit/v3/relyingparty/getAccountInfo?key=#{firebase_api_key}"
|
51
|
+
end
|
52
|
+
|
53
|
+
def firebase_update_url
|
54
|
+
"https://identitytoolkit.googleapis.com/v1/accounts:update?key=#{firebase_api_key}"
|
55
|
+
end
|
56
|
+
|
57
|
+
def firebase_api_key
|
58
|
+
Ibrain::Auth::Config.firebase_api_key
|
59
|
+
end
|
60
|
+
|
61
|
+
def base_headers
|
62
|
+
{
|
63
|
+
'Content-Type' => 'application/json'
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
def normalize_params
|
68
|
+
params.require(:auth).permit(:id_token)
|
69
|
+
end
|
70
|
+
|
71
|
+
def manual_params
|
72
|
+
params.require(:auth).permit(:username, :password)
|
73
|
+
end
|
74
|
+
|
75
|
+
def sso_verify
|
76
|
+
response = HTTParty.post(url, headers: base_headers, body: { 'idToken' => normalize_params[:id_token] }.to_json )
|
77
|
+
uid = response.try(:fetch, 'users', []).try(:at, 0).try(:fetch, 'localId', nil)
|
78
|
+
|
79
|
+
raise ActiveRecord::NotFound, I18n.t('ibrain.errors.account.not_found') if uid.blank?
|
80
|
+
|
81
|
+
Ibrain.user_class.find_by(uid: uid)
|
82
|
+
end
|
83
|
+
|
84
|
+
def available_columns
|
85
|
+
Ibrain.user_class.column_names.select { |f| ACCOUNT_COUMNS.include?(f) }
|
86
|
+
end
|
87
|
+
end
|
@@ -0,0 +1,317 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Assuming you have not yet modified this file, each configuration option below
|
4
|
+
# is set to its default value. Note that some are commented out while others
|
5
|
+
# are not: uncommented lines are intended to protect your configuration from
|
6
|
+
# breaking changes in upgrades (i.e., in the event that future versions of
|
7
|
+
# Devise change the default values for those options).
|
8
|
+
#
|
9
|
+
# Use this hook to configure devise mailer, warden hooks and so forth.
|
10
|
+
# Many of these configuration options can be set straight in your model.
|
11
|
+
Devise.setup do |config|
|
12
|
+
# The secret key used by Devise. Devise uses this key to generate
|
13
|
+
# random tokens. Changing this key will render invalid all existing
|
14
|
+
# confirmation, reset password and unlock tokens in the database.
|
15
|
+
# Devise will use the `secret_key_base` as its `secret_key`
|
16
|
+
# by default. You can change it below and use your own secret key.
|
17
|
+
# config.secret_key = '05f081e028de57b374973bd38d8cfb4782d886f6919a45983bc77299e7b1900cdd93c80adf332e462d17dad92eeb4fb78ddb4a4bf6c64833786e0c2582fb5470'
|
18
|
+
|
19
|
+
# ==> Controller configuration
|
20
|
+
# Configure the parent class to the devise controllers.
|
21
|
+
# config.parent_controller = 'DeviseController'
|
22
|
+
|
23
|
+
# ==> Mailer Configuration
|
24
|
+
# Configure the e-mail address which will be shown in Devise::Mailer,
|
25
|
+
# note that it will be overwritten if you use your own mailer class
|
26
|
+
# with default "from" parameter.
|
27
|
+
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
28
|
+
|
29
|
+
# Configure the class responsible to send e-mails.
|
30
|
+
# config.mailer = 'Devise::Mailer'
|
31
|
+
|
32
|
+
# Configure the parent class responsible to send e-mails.
|
33
|
+
# config.parent_mailer = 'ActionMailer::Base'
|
34
|
+
|
35
|
+
# ==> ORM configuration
|
36
|
+
# Load and configure the ORM. Supports :active_record (default) and
|
37
|
+
# :mongoid (bson_ext recommended) by default. Other ORMs may be
|
38
|
+
# available as additional gems.
|
39
|
+
require 'devise/orm/active_record'
|
40
|
+
|
41
|
+
# ==> Configuration for any authentication mechanism
|
42
|
+
# Configure which keys are used when authenticating a user. The default is
|
43
|
+
# just :email. You can configure it to use [:username, :subdomain], so for
|
44
|
+
# authenticating a user, both parameters are required. Remember that those
|
45
|
+
# parameters are used only when authenticating and not when retrieving from
|
46
|
+
# session. If you need permissions, you should implement that in a before filter.
|
47
|
+
# You can also supply a hash where the value is a boolean determining whether
|
48
|
+
# or not authentication should be aborted when the value is not present.
|
49
|
+
config.authentication_keys = [:username, :email]
|
50
|
+
|
51
|
+
# Configure parameters from the request object used for authentication. Each entry
|
52
|
+
# given should be a request method and it will automatically be passed to the
|
53
|
+
# find_for_authentication method and considered in your model lookup. For instance,
|
54
|
+
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
55
|
+
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
56
|
+
# config.request_keys = []
|
57
|
+
|
58
|
+
# Configure which authentication keys should be case-insensitive.
|
59
|
+
# These keys will be downcased upon creating or modifying a user and when used
|
60
|
+
# to authenticate or find a user. Default is :username.
|
61
|
+
config.case_insensitive_keys = [:username, :email]
|
62
|
+
|
63
|
+
# Configure which authentication keys should have whitespace stripped.
|
64
|
+
# These keys will have whitespace before and after removed upon creating or
|
65
|
+
# modifying a user and when used to authenticate or find a user. Default is :username.
|
66
|
+
config.strip_whitespace_keys = [:username, :email]
|
67
|
+
|
68
|
+
# Tell if authentication through request.params is enabled. True by default.
|
69
|
+
# It can be set to an array that will enable params authentication only for the
|
70
|
+
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
71
|
+
# enable it only for database (email + password) authentication.
|
72
|
+
# config.params_authenticatable = true
|
73
|
+
|
74
|
+
# Tell if authentication through HTTP Auth is enabled. False by default.
|
75
|
+
# It can be set to an array that will enable http authentication only for the
|
76
|
+
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
77
|
+
# enable it only for database authentication.
|
78
|
+
# For API-only applications to support authentication "out-of-the-box", you will likely want to
|
79
|
+
# enable this with :database unless you are using a custom strategy.
|
80
|
+
# The supported strategies are:
|
81
|
+
# :database = Support basic authentication with authentication key + password
|
82
|
+
# config.http_authenticatable = false
|
83
|
+
|
84
|
+
# If 401 status code should be returned for AJAX requests. True by default.
|
85
|
+
# config.http_authenticatable_on_xhr = true
|
86
|
+
|
87
|
+
# The realm used in Http Basic Authentication. 'Application' by default.
|
88
|
+
# config.http_authentication_realm = 'Application'
|
89
|
+
|
90
|
+
# It will change confirmation, password recovery and other workflows
|
91
|
+
# to behave the same regardless if the e-mail provided was right or wrong.
|
92
|
+
# Does not affect registerable.
|
93
|
+
# config.paranoid = true
|
94
|
+
|
95
|
+
# By default Devise will store the user in session. You can skip storage for
|
96
|
+
# particular strategies by setting this option.
|
97
|
+
# Notice that if you are skipping storage for all authentication paths, you
|
98
|
+
# may want to disable generating routes to Devise's sessions controller by
|
99
|
+
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
100
|
+
config.skip_session_storage = [:http_auth]
|
101
|
+
|
102
|
+
# By default, Devise cleans up the CSRF token on authentication to
|
103
|
+
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
104
|
+
# requests for sign in and sign up, you need to get a new CSRF token
|
105
|
+
# from the server. You can disable this option at your own risk.
|
106
|
+
# config.clean_up_csrf_token_on_authentication = true
|
107
|
+
|
108
|
+
# When false, Devise will not attempt to reload routes on eager load.
|
109
|
+
# This can reduce the time taken to boot the app but if your application
|
110
|
+
# requires the Devise mappings to be loaded during boot time the application
|
111
|
+
# won't boot properly.
|
112
|
+
# config.reload_routes = true
|
113
|
+
|
114
|
+
# ==> Configuration for :database_authenticatable
|
115
|
+
# For bcrypt, this is the cost for hashing the password and defaults to 12. If
|
116
|
+
# using other algorithms, it sets how many times you want the password to be hashed.
|
117
|
+
# The number of stretches used for generating the hashed password are stored
|
118
|
+
# with the hashed password. This allows you to change the stretches without
|
119
|
+
# invalidating existing passwords.
|
120
|
+
#
|
121
|
+
# Limiting the stretches to just one in testing will increase the performance of
|
122
|
+
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
123
|
+
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
124
|
+
# algorithm), the cost increases exponentially with the number of stretches (e.g.
|
125
|
+
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
126
|
+
config.stretches = Rails.env.test? ? 1 : 12
|
127
|
+
|
128
|
+
# Set up a pepper to generate the hashed password.
|
129
|
+
# config.pepper = '3df46a10f22a3580f28b33634134bfbfe9c62f8fb9dc18c8d310d174f7699b939e6fa64761c45674580487804f1f514d0d9b11538d3fc90a1c514e21dd4f1ce1'
|
130
|
+
|
131
|
+
# Send a notification to the original email when the user's email is changed.
|
132
|
+
# config.send_email_changed_notification = false
|
133
|
+
|
134
|
+
# Send a notification email when the user's password is changed.
|
135
|
+
# config.send_password_change_notification = false
|
136
|
+
|
137
|
+
# ==> Configuration for :confirmable
|
138
|
+
# A period that the user is allowed to access the website even without
|
139
|
+
# confirming their account. For instance, if set to 2.days, the user will be
|
140
|
+
# able to access the website for two days without confirming their account,
|
141
|
+
# access will be blocked just in the third day.
|
142
|
+
# You can also set it to nil, which will allow the user to access the website
|
143
|
+
# without confirming their account.
|
144
|
+
# Default is 0.days, meaning the user cannot access the website without
|
145
|
+
# confirming their account.
|
146
|
+
# config.allow_unconfirmed_access_for = 2.days
|
147
|
+
|
148
|
+
# A period that the user is allowed to confirm their account before their
|
149
|
+
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
150
|
+
# their account within 3 days after the mail was sent, but on the fourth day
|
151
|
+
# their account can't be confirmed with the token any more.
|
152
|
+
# Default is nil, meaning there is no restriction on how long a user can take
|
153
|
+
# before confirming their account.
|
154
|
+
# config.confirm_within = 3.days
|
155
|
+
|
156
|
+
# If true, requires any email changes to be confirmed (exactly the same way as
|
157
|
+
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
158
|
+
# db field (see migrations). Until confirmed, new email is stored in
|
159
|
+
# unconfirmed_email column, and copied to email column on successful confirmation.
|
160
|
+
config.reconfirmable = true
|
161
|
+
|
162
|
+
# Defines which key will be used when confirming an account
|
163
|
+
# config.confirmation_keys = [:email]
|
164
|
+
|
165
|
+
# ==> Configuration for :rememberable
|
166
|
+
# The time the user will be remembered without asking for credentials again.
|
167
|
+
# config.remember_for = 2.weeks
|
168
|
+
|
169
|
+
# Invalidates all the remember me tokens when the user signs out.
|
170
|
+
config.expire_all_remember_me_on_sign_out = true
|
171
|
+
|
172
|
+
# If true, extends the user's remember period when remembered via cookie.
|
173
|
+
# config.extend_remember_period = false
|
174
|
+
|
175
|
+
# Options to be passed to the created cookie. For instance, you can set
|
176
|
+
# secure: true in order to force SSL only cookies.
|
177
|
+
# config.rememberable_options = {}
|
178
|
+
|
179
|
+
# ==> Configuration for :validatable
|
180
|
+
# Range for password length.
|
181
|
+
config.password_length = 6..128
|
182
|
+
|
183
|
+
# Email regex used to validate email formats. It simply asserts that
|
184
|
+
# one (and only one) @ exists in the given string. This is mainly
|
185
|
+
# to give user feedback and not to assert the e-mail validity.
|
186
|
+
config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
|
187
|
+
|
188
|
+
# ==> Configuration for :timeoutable
|
189
|
+
# The time you want to timeout the user session without activity. After this
|
190
|
+
# time the user will be asked for credentials again. Default is 30 minutes.
|
191
|
+
# config.timeout_in = 30.minutes
|
192
|
+
|
193
|
+
# ==> Configuration for :lockable
|
194
|
+
# Defines which strategy will be used to lock an account.
|
195
|
+
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
196
|
+
# :none = No lock strategy. You should handle locking by yourself.
|
197
|
+
# config.lock_strategy = :failed_attempts
|
198
|
+
|
199
|
+
# Defines which key will be used when locking and unlocking an account
|
200
|
+
# config.unlock_keys = [:email]
|
201
|
+
|
202
|
+
# Defines which strategy will be used to unlock an account.
|
203
|
+
# :email = Sends an unlock link to the user email
|
204
|
+
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
205
|
+
# :both = Enables both strategies
|
206
|
+
# :none = No unlock strategy. You should handle unlocking by yourself.
|
207
|
+
# config.unlock_strategy = :both
|
208
|
+
|
209
|
+
# Number of authentication tries before locking an account if lock_strategy
|
210
|
+
# is failed attempts.
|
211
|
+
# config.maximum_attempts = 20
|
212
|
+
|
213
|
+
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
214
|
+
# config.unlock_in = 1.hour
|
215
|
+
|
216
|
+
# Warn on the last attempt before the account is locked.
|
217
|
+
# config.last_attempt_warning = true
|
218
|
+
|
219
|
+
# ==> Configuration for :recoverable
|
220
|
+
#
|
221
|
+
# Defines which key will be used when recovering the password for an account
|
222
|
+
# config.reset_password_keys = [:email]
|
223
|
+
|
224
|
+
# Time interval you can reset your password with a reset password key.
|
225
|
+
# Don't put a too small interval or your users won't have the time to
|
226
|
+
# change their passwords.
|
227
|
+
config.reset_password_within = 6.hours
|
228
|
+
|
229
|
+
# When set to false, does not sign a user in automatically after their password is
|
230
|
+
# reset. Defaults to true, so a user is signed in automatically after a reset.
|
231
|
+
# config.sign_in_after_reset_password = true
|
232
|
+
|
233
|
+
# ==> Configuration for :encryptable
|
234
|
+
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).
|
235
|
+
# You can use :sha1, :sha512 or algorithms from others authentication tools as
|
236
|
+
# :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
|
237
|
+
# for default behavior) and :restful_authentication_sha1 (then you should set
|
238
|
+
# stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
|
239
|
+
#
|
240
|
+
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
241
|
+
# config.encryptor = :sha512
|
242
|
+
|
243
|
+
# ==> Scopes configuration
|
244
|
+
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
245
|
+
# "users/sessions/new". It's turned off by default because it's slower if you
|
246
|
+
# are using only default views.
|
247
|
+
# config.scoped_views = false
|
248
|
+
|
249
|
+
# Configure the default scope given to Warden. By default it's the first
|
250
|
+
# devise role declared in your routes (usually :user).
|
251
|
+
# config.default_scope = :user
|
252
|
+
|
253
|
+
# Set this configuration to false if you want /users/sign_out to sign out
|
254
|
+
# only the current scope. By default, Devise signs out all scopes.
|
255
|
+
# config.sign_out_all_scopes = true
|
256
|
+
|
257
|
+
# ==> Navigation configuration
|
258
|
+
# Lists the formats that should be treated as navigational. Formats like
|
259
|
+
# :html, should redirect to the sign in page when the user does not have
|
260
|
+
# access, but formats like :xml or :json, should return 401.
|
261
|
+
#
|
262
|
+
# If you have any extra navigational formats, like :iphone or :mobile, you
|
263
|
+
# should add them to the navigational formats lists.
|
264
|
+
#
|
265
|
+
# The "*/*" below is required to match Internet Explorer requests.
|
266
|
+
# config.navigational_formats = ['*/*', :html]
|
267
|
+
|
268
|
+
# The default HTTP method used to sign out a resource. Default is :delete.
|
269
|
+
config.sign_out_via = :delete
|
270
|
+
|
271
|
+
# ==> OmniAuth
|
272
|
+
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
273
|
+
# up on your models and hooks.
|
274
|
+
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
275
|
+
|
276
|
+
# ==> Warden configuration
|
277
|
+
# If you want to use other strategies, that are not supported by Devise, or
|
278
|
+
# change the failure app, you can configure them inside the config.warden block.
|
279
|
+
#
|
280
|
+
# config.warden do |manager|
|
281
|
+
# manager.intercept_401 = false
|
282
|
+
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
283
|
+
# end
|
284
|
+
|
285
|
+
# ==> Mountable engine configurations
|
286
|
+
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
287
|
+
# is mountable, there are some extra configurations to be taken into account.
|
288
|
+
# The following options are available, assuming the engine is mounted as:
|
289
|
+
#
|
290
|
+
# mount MyEngine, at: '/my_engine'
|
291
|
+
#
|
292
|
+
# The router that invoked `devise_for`, in the example above, would be:
|
293
|
+
# config.router_name = :my_engine
|
294
|
+
#
|
295
|
+
# When using OmniAuth, Devise cannot automatically set OmniAuth path,
|
296
|
+
# so you need to do it manually. For the users scope, it would be:
|
297
|
+
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
298
|
+
|
299
|
+
# ==> Turbolinks configuration
|
300
|
+
# If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
|
301
|
+
#
|
302
|
+
# ActiveSupport.on_load(:devise_failure_app) do
|
303
|
+
# include Turbolinks::Controller
|
304
|
+
# end
|
305
|
+
|
306
|
+
# ==> Configuration for :registerable
|
307
|
+
|
308
|
+
# When set to false, does not sign a user in automatically after their password is
|
309
|
+
# changed. Defaults to true, so a user is signed in automatically after changing a password.
|
310
|
+
# config.sign_in_after_change_password = true
|
311
|
+
|
312
|
+
# ==> Configuration for jwt
|
313
|
+
config.jwt do |jwt|
|
314
|
+
jwt.secret = Ibrain::Auth::Config.jwt_secret_key # Rails.application.credentials.secret_key_base
|
315
|
+
jwt.expiration_time = 3600 * 24 * 30 # 30day
|
316
|
+
end
|
317
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
en:
|
2
|
+
ibrain:
|
3
|
+
system:
|
4
|
+
messages:
|
5
|
+
success: Retrieving data successfully
|
6
|
+
ok: Retrieving data successfully
|
7
|
+
errors:
|
8
|
+
session:
|
9
|
+
invalid_session: Invalid login session. Please try again!
|
10
|
+
expired_session: The login session has expired.
|
11
|
+
account:
|
12
|
+
not_found: Account not found
|
@@ -0,0 +1,12 @@
|
|
1
|
+
vi:
|
2
|
+
ibrain:
|
3
|
+
system:
|
4
|
+
message:
|
5
|
+
success: Lấy dữ liệu thành công
|
6
|
+
ok: Lấy dữ liệu thành công
|
7
|
+
errors:
|
8
|
+
session:
|
9
|
+
invalid_session: Phiên đăng nhập không hợp lệ. Vui lòng thử lại!
|
10
|
+
expired_session: Phiên đăng nhập đã hết hạn.
|
11
|
+
account:
|
12
|
+
not_found: Không tìm thấy tài khoản
|
data/config/routes.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Ibrain::Core::Engine.routes.draw do
|
4
|
+
devise_for :users, controllers: {
|
5
|
+
sessions: "ibrain/auth/sessions",
|
6
|
+
registrations: "ibrain/auth/registrations"
|
7
|
+
},
|
8
|
+
path: "api/#{Ibrain::Config.api_version}/users",
|
9
|
+
defaults: { format: :json }
|
10
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module Ibrain
|
6
|
+
module Auth
|
7
|
+
class InstallGenerator < Rails::Generators::Base
|
8
|
+
class_option :with_ridgepole, type: :boolean, default: true
|
9
|
+
|
10
|
+
def self.source_paths
|
11
|
+
paths = superclass.source_paths
|
12
|
+
paths << File.expand_path('templates', __dir__)
|
13
|
+
paths.flatten
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_files
|
17
|
+
template 'config/initializers/devise.rb.tt', 'config/initializers/devise.rb', { skip: true }
|
18
|
+
template 'config/initializers/ibrain_auth.rb.tt', 'config/initializers/ibrain_auth.rb', { skip: true }
|
19
|
+
|
20
|
+
if options[:with_ridgepole]
|
21
|
+
template 'db/schemas/users_schema.erb', 'db/schemas/users.schema', { skip: true }
|
22
|
+
else
|
23
|
+
template 'db/schemas/users_migrate.erb', "db/migrate/#{Time.current.to_i}_add_users.rb", { skip: true }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Ibrain::Auth.config do |config|
|
2
|
+
# Api version as namespace at routes
|
3
|
+
# config.api_version = 'v1'
|
4
|
+
|
5
|
+
# Please fill firebase_api_key
|
6
|
+
config.firebase_api_key = 'FIREBASE_API_KEY'
|
7
|
+
|
8
|
+
# Can use RAILS_MASTER_KEY or something else
|
9
|
+
config.jwt_secret_key = 'RAILS_MASTER_KEY'
|
10
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class CreateTables < ActiveRecord::Migration[6.0]
|
2
|
+
def change
|
3
|
+
create_table 'users', force: :cascade do |t|
|
4
|
+
t.string 'email'
|
5
|
+
t.string 'password_digest', null: false, default: ''
|
6
|
+
|
7
|
+
## Recoverable
|
8
|
+
t.string :reset_password_token
|
9
|
+
t.datetime :reset_password_sent_at
|
10
|
+
|
11
|
+
## Rememberable
|
12
|
+
t.datetime :remember_created_at
|
13
|
+
|
14
|
+
## Trackable
|
15
|
+
t.integer :sign_in_count, default: 0, null: false
|
16
|
+
t.datetime :current_sign_in_at
|
17
|
+
t.datetime :last_sign_in_at
|
18
|
+
t.string :current_sign_in_ip
|
19
|
+
t.string :last_sign_in_ip
|
20
|
+
t.string :uid
|
21
|
+
|
22
|
+
## Confirmable
|
23
|
+
# t.string :confirmation_token
|
24
|
+
# t.datetime :confirmed_at
|
25
|
+
# t.datetime :confirmation_sent_at
|
26
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
27
|
+
|
28
|
+
## Lockable
|
29
|
+
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
30
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
31
|
+
# t.datetime :locked_at
|
32
|
+
|
33
|
+
t.timestamps
|
34
|
+
|
35
|
+
t.index :reset_password_token, unique: true
|
36
|
+
t.index :uid, unique: true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
create_table 'users', force: :cascade do |t|
|
4
|
+
t.string 'email'
|
5
|
+
t.string 'password_digest', null: false, default: ''
|
6
|
+
|
7
|
+
## Recoverable
|
8
|
+
t.string :reset_password_token
|
9
|
+
t.datetime :reset_password_sent_at
|
10
|
+
|
11
|
+
## Rememberable
|
12
|
+
t.datetime :remember_created_at
|
13
|
+
|
14
|
+
## Trackable
|
15
|
+
t.integer :sign_in_count, default: 0, null: false
|
16
|
+
t.datetime :current_sign_in_at
|
17
|
+
t.datetime :last_sign_in_at
|
18
|
+
t.string :current_sign_in_ip
|
19
|
+
t.string :last_sign_in_ip
|
20
|
+
t.string :uid
|
21
|
+
|
22
|
+
## Confirmable
|
23
|
+
# t.string :confirmation_token
|
24
|
+
# t.datetime :confirmed_at
|
25
|
+
# t.datetime :confirmation_sent_at
|
26
|
+
# t.string :unconfirmed_email # Only if using reconfirmable
|
27
|
+
|
28
|
+
## Lockable
|
29
|
+
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
|
30
|
+
# t.string :unlock_token # Only if unlock strategy is :email or :both
|
31
|
+
# t.datetime :locked_at
|
32
|
+
|
33
|
+
t.timestamps
|
34
|
+
|
35
|
+
t.index :reset_password_token, unique: true
|
36
|
+
t.index :uid, unique: true
|
37
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ibrain
|
4
|
+
module Auth
|
5
|
+
# Load the same version defaults for all available Ibrain components
|
6
|
+
#
|
7
|
+
# @see Ibrain::Preferences::Configuration#load_defaults
|
8
|
+
def self.load_defaults(version)
|
9
|
+
Ibrain::Auth::Config.load_defaults(version)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.config(&_block)
|
13
|
+
yield(Ibrain::Auth::Config)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'devise'
|
4
|
+
require 'devise-encryptable'
|
5
|
+
|
6
|
+
module Ibrain
|
7
|
+
module Auth
|
8
|
+
class Engine < Rails::Engine
|
9
|
+
isolate_namespace Ibrain::Auth
|
10
|
+
engine_name 'ibrain_auth'
|
11
|
+
config.generators.api_only = true
|
12
|
+
|
13
|
+
initializer 'ibrain.auth.environment', before: :load_config_initializers do |_app|
|
14
|
+
require 'ibrain/auth_configuration'
|
15
|
+
|
16
|
+
Ibrain::Auth::Config = Ibrain::AuthConfiguration.new
|
17
|
+
end
|
18
|
+
|
19
|
+
config.to_prepare do
|
20
|
+
ApplicationController.include Ibrain::AuthenticationHelpers
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.fallback_on_unauthorized?
|
24
|
+
return false unless Ibrain::Config.respond_to?(:fallback_on_unauthorized)
|
25
|
+
|
26
|
+
if Ibrain::Config.fallback_on_unauthorized
|
27
|
+
true
|
28
|
+
else
|
29
|
+
Ibrain::Deprecation.warn <<-WARN.strip_heredoc, caller
|
30
|
+
Having Ibrain::Config.fallback_on_unauthorized set
|
31
|
+
to `false` is deprecated and will not be supported.
|
32
|
+
Please change this configuration to `true` and be sure that your
|
33
|
+
application does not break trying to redirect back when there is
|
34
|
+
an unauthorized access.
|
35
|
+
WARN
|
36
|
+
|
37
|
+
false
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ibrain
|
4
|
+
# frozen_string_literal: true
|
5
|
+
|
6
|
+
module Auth
|
7
|
+
VERSION = '0.1.0'
|
8
|
+
|
9
|
+
def self.ibrain_auth_version
|
10
|
+
VERSION
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.previous_ibrain_auth_minor_version
|
14
|
+
'0.1.0'
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.ibrain_auth_gem_version
|
18
|
+
Gem::Version.new(ibrain_auth_version)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/ibrain/auth.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ibrain_core'
|
4
|
+
require 'devise'
|
5
|
+
require 'devise-encryptable'
|
6
|
+
require 'devise/jwt'
|
7
|
+
|
8
|
+
require 'ibrain/auth/devise'
|
9
|
+
require 'ibrain/auth/version'
|
10
|
+
require 'ibrain/auth/engine'
|
11
|
+
require 'ibrain/authentication_helpers'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ibrain
|
4
|
+
class AuthConfiguration < Preferences::Configuration
|
5
|
+
preference :api_version, :string, default: 'v1'
|
6
|
+
# Firebase API Key
|
7
|
+
preference :firebase_api_key, :string, default: nil
|
8
|
+
|
9
|
+
# JWT Secret key
|
10
|
+
preference :jwt_secret_key, :string, default: nil
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ibrain
|
4
|
+
module AuthenticationHelpers
|
5
|
+
def self.included(receiver)
|
6
|
+
receiver.send(:helper_method, :ibrain_current_user) if receiver.send(:respond_to?, :helper_method)
|
7
|
+
end
|
8
|
+
|
9
|
+
def ibrain_current_user
|
10
|
+
current_user
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/ibrain_auth.rb
ADDED
metadata
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ibrain-auth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tai Nguyen Van
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-12-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: devise
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.8.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: devise-encryptable
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: devise-i18n
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.10.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.10.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: devise-jwt
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.9.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: ibrain-core
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.1.5
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.1.5
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 6.1.4
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 6.1.4.1
|
93
|
+
type: :runtime
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: 6.1.4
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 6.1.4.1
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: omniauth
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.0.4
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 2.0.4
|
117
|
+
description: Its Auth is an sso authen gem for Ruby on Rails.
|
118
|
+
email:
|
119
|
+
- john@techfox.io
|
120
|
+
executables: []
|
121
|
+
extensions: []
|
122
|
+
extra_rdoc_files: []
|
123
|
+
files:
|
124
|
+
- MIT-LICENSE
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- app/controllers/ibrain/auth/confirmations_controller.rb
|
128
|
+
- app/controllers/ibrain/auth/passwords_controller.rb
|
129
|
+
- app/controllers/ibrain/auth/registrations_controller.rb
|
130
|
+
- app/controllers/ibrain/auth/sessions_controller.rb
|
131
|
+
- app/controllers/ibrain/auth/unlocks_controller.rb
|
132
|
+
- app/models/ibrain/auth/user.rb
|
133
|
+
- app/repositories/auth_repository.rb
|
134
|
+
- config/initializers/devise.rb
|
135
|
+
- config/locales/en.yml
|
136
|
+
- config/locales/jp.yml
|
137
|
+
- config/locales/vi.yml
|
138
|
+
- config/routes.rb
|
139
|
+
- lib/generators/ibrain/auth/install/install_generator.rb
|
140
|
+
- lib/generators/ibrain/auth/install/templates/config/initializers/devise.rb.tt
|
141
|
+
- lib/generators/ibrain/auth/install/templates/config/initializers/ibrain_auth.rb.tt
|
142
|
+
- lib/generators/ibrain/auth/install/templates/db/schemas/users_migrate.erb
|
143
|
+
- lib/generators/ibrain/auth/install/templates/db/schemas/users_schema.erb
|
144
|
+
- lib/ibrain/auth.rb
|
145
|
+
- lib/ibrain/auth/devise.rb
|
146
|
+
- lib/ibrain/auth/engine.rb
|
147
|
+
- lib/ibrain/auth/version.rb
|
148
|
+
- lib/ibrain/auth_configuration.rb
|
149
|
+
- lib/ibrain/authentication_helpers.rb
|
150
|
+
- lib/ibrain_auth.rb
|
151
|
+
- lib/tasks/ibrain/auth_tasks.rake
|
152
|
+
homepage: https://techfox.io
|
153
|
+
licenses:
|
154
|
+
- MIT
|
155
|
+
metadata:
|
156
|
+
rubygems_mfa_required: 'true'
|
157
|
+
post_install_message:
|
158
|
+
rdoc_options: []
|
159
|
+
require_paths:
|
160
|
+
- lib
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
requirements: []
|
172
|
+
rubygems_version: 3.2.22
|
173
|
+
signing_key:
|
174
|
+
specification_version: 4
|
175
|
+
summary: Its Auth is an sso authen gem for Ruby on Rails.
|
176
|
+
test_files: []
|