ibrain-auth 0.3.10 → 0.3.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/ibrain/user.rb +1 -4
- data/app/repositories/firebase_repository.rb +16 -1
- data/lib/generators/ibrain/auth/install/templates/config/initializers/ibrain_auth.rb.tt +7 -1
- data/lib/ibrain/auth/version.rb +1 -1
- data/lib/ibrain/auth_configuration.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bf38a18f89f6e66bb4450e293ab3305fcc2b6e6d1b0826606bd208ea60c759a
|
4
|
+
data.tar.gz: c7e77a73069af88f79d33e03e8556c63593aed2d0e7c9bad651bab4d7087ee92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f2c0c9b8c895e10f062e460b7886cba2ca5c6f02fdfa66e772bb16e5cc45f1044dd647aff72033ff732c1801e079c2ff4ef65dfd88b88c26403c048d32e4d8f2
|
7
|
+
data.tar.gz: 7ea121349f47cdc3e6bb728c1ee70db0509c72f88ba1f2ef033040f36fad660f1331e2cd47861c27c2ebe2a28f8abe7680b126e318955cb612d27d40100e2104
|
data/app/models/ibrain/user.rb
CHANGED
@@ -9,10 +9,7 @@ module Ibrain
|
|
9
9
|
self.abstract_class = true
|
10
10
|
self.table_name = Ibrain::Auth::Config.user_table_name
|
11
11
|
|
12
|
-
devise :
|
13
|
-
:recoverable, :validatable, :timeoutable, :omniauthable,
|
14
|
-
:jwt_authenticatable, jwt_revocation_strategy: self,
|
15
|
-
omniauth_providers: %i[apple facebook twitter line]
|
12
|
+
# devise(*Ibrain::Auth::Config.devise_enabled_modules, jwt_revocation_strategy: self, omniauth_providers: Ibrain::Auth::Config.devise_omniauth_providers)
|
16
13
|
|
17
14
|
scope :find_by_line, ->(uid) {
|
18
15
|
find_by(uid: uid, provider: 'line')
|
@@ -1,10 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'open-uri'
|
4
|
+
|
3
5
|
class FirebaseRepository < Ibrain::BaseRepository
|
4
6
|
def initialize(record, params)
|
5
7
|
super(nil, record)
|
6
8
|
|
7
|
-
@private_key_json =
|
9
|
+
@private_key_json = load_private_file
|
8
10
|
@firebase_owner_email = Ibrain::Auth::Config.firebase_owner_email
|
9
11
|
@params = params
|
10
12
|
end
|
@@ -36,4 +38,17 @@ class FirebaseRepository < Ibrain::BaseRepository
|
|
36
38
|
def private_key
|
37
39
|
OpenSSL::PKey::RSA.new json_firebase[:private_key]
|
38
40
|
end
|
41
|
+
|
42
|
+
def load_private_file
|
43
|
+
is_remote = Ibrain::Auth::Config.firebase_private_key_path.include?("http")
|
44
|
+
|
45
|
+
if is_remote
|
46
|
+
uri = URI.parse(Ibrain::Auth::Config.firebase_private_key_path)
|
47
|
+
content = uri.open { |f| f.read }
|
48
|
+
|
49
|
+
return content
|
50
|
+
end
|
51
|
+
|
52
|
+
File.open(Ibrain::Auth::Config.firebase_private_key_path).read
|
53
|
+
end
|
39
54
|
end
|
@@ -26,6 +26,12 @@ Ibrain::Auth.config do |config|
|
|
26
26
|
# firebase owner email
|
27
27
|
config.firebase_owner_email = nil
|
28
28
|
|
29
|
-
# social
|
29
|
+
# social login graphql input
|
30
30
|
config.social_sign_in_input = Ibrain::Types::Input::SocialSignInInput
|
31
|
+
|
32
|
+
# devise modules setting
|
33
|
+
config.devise_enabled_modules = %i[database_authenticatable registerable confirmable recoverable validatable timeoutable omniauthable jwt_authenticatable]
|
34
|
+
|
35
|
+
# devise social providers setting
|
36
|
+
config.devise_omniauth_providers = %i[apple facebook twitter line]
|
31
37
|
end
|
data/lib/ibrain/auth/version.rb
CHANGED
@@ -27,6 +27,13 @@ module Ibrain
|
|
27
27
|
# firebase owner email
|
28
28
|
preference :firebase_owner_email, :string, default: nil
|
29
29
|
|
30
|
+
# social login graphql input
|
30
31
|
preference :social_sign_in_input, :class, default: Ibrain::Types::Input::SocialSignInInput
|
32
|
+
|
33
|
+
# devise modules setting
|
34
|
+
preference :devise_enabled_modules, :array, default: %i[database_authenticatable registerable confirmable recoverable validatable timeoutable omniauthable jwt_authenticatable]
|
35
|
+
|
36
|
+
# devise social providers setting
|
37
|
+
preference :devise_omniauth_providers, :array, default: %i[apple facebook twitter line]
|
31
38
|
end
|
32
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibrain-auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tai Nguyen Van
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|