devise_auth_proxy 0.2.11 → 0.2.12
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/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/devise_auth_proxy.rb +4 -1
- data/lib/devise_auth_proxy/manager.rb +17 -1
- data/lib/devise_auth_proxy/version.rb +1 -1
- 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: e7a171ab0bda47942e6456c5fb3805b7f6a808560edaf7a5296233721c095955
|
4
|
+
data.tar.gz: 75a637d6010f82c0a7ac2490b74c96747f299679953e4af2ef1cda42ef42bf40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78d177ed2ee869ae1ce29c02b73d86fa9ba60d1e0860f440980c6d888453d7b91f94300cd236b48ef331e5ccf8a610903b09e569c460cf65e02b991985096d7d
|
7
|
+
data.tar.gz: a051a30029dbd0bee7083ac75879bec88fee54c5bf3377cf41a27ed689b12c714c48618757b0cdb65c6889f749a8bc6eb53825360b50724173f1e6165163dd56
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -35,7 +35,7 @@ Configuration options:
|
|
35
35
|
* `logout_service` - String. A service to handle logout session.
|
36
36
|
* `skip_session` - Boolean (default: false). To skip storage login session.
|
37
37
|
* `logout_url` - String (default: '/'). For redirecting to a proxy user logout URL after signing out of the Rails application. Include DeviseAuthProxy::ControllerBehavior in your application controller to enable (by overriding Devise's after_sign_out_path_for).
|
38
|
-
|
38
|
+
* `specific_database` - String (default: :disable). For setting a specific database to authenticate.
|
39
39
|
|
40
40
|
Set options in a Rails initializer (e.g., `config/intializers/devise.rb`):
|
41
41
|
|
@@ -51,6 +51,7 @@ DeviseAuthProxy.configure do |config|
|
|
51
51
|
config.logout_service = '<service name>'
|
52
52
|
config.skip_session = true
|
53
53
|
config.logout_url = "http://localhost:3000/logout"
|
54
|
+
config.specific_database = 'login_database'
|
54
55
|
end
|
55
56
|
```
|
56
57
|
|
data/lib/devise_auth_proxy.rb
CHANGED
@@ -5,7 +5,7 @@ module DeviseAuthProxy
|
|
5
5
|
class << self
|
6
6
|
attr_accessor :env_key, :auto_create, :auto_update, :auth_key,
|
7
7
|
:attribute_map, :default_role, :logout_service, :logout_url,
|
8
|
-
:skip_session
|
8
|
+
:skip_session, :specific_database
|
9
9
|
end
|
10
10
|
|
11
11
|
# request.env key for remote user name
|
@@ -39,6 +39,9 @@ module DeviseAuthProxy
|
|
39
39
|
# To skip storage login session. Default is false.
|
40
40
|
self.skip_session = false
|
41
41
|
|
42
|
+
# To use a specific database for authenticate.
|
43
|
+
self.specific_database = :disable
|
44
|
+
|
42
45
|
def self.configure
|
43
46
|
yield self
|
44
47
|
end
|
@@ -23,11 +23,23 @@ module DeviseAuthProxy
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def find_user
|
26
|
+
if DeviseAuthProxy.specific_database != :disable
|
27
|
+
klass.with(client: DeviseAuthProxy.specific_database) do |admin|
|
28
|
+
return admin.where(user_criterion).first
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
26
32
|
klass.where(user_criterion).first
|
27
33
|
end
|
28
34
|
|
29
35
|
def create_user
|
30
36
|
unless Devise.mappings[:admin_user].strategies.include?(:database_authenticatable)
|
37
|
+
if DeviseAuthProxy.specific_database != :disable
|
38
|
+
klass.with(client: DeviseAuthProxy.specific_database) do |admin|
|
39
|
+
return admin.create(user_criterion)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
31
43
|
return klass.create(user_criterion)
|
32
44
|
end
|
33
45
|
|
@@ -38,7 +50,11 @@ module DeviseAuthProxy
|
|
38
50
|
roles: DeviseAuthProxy.default_role
|
39
51
|
})
|
40
52
|
|
41
|
-
|
53
|
+
if DeviseAuthProxy.specific_database != :disable
|
54
|
+
klass.with(client: DeviseAuthProxy.specific_database) do |admin|
|
55
|
+
return admin.create(attrs)
|
56
|
+
end
|
57
|
+
end
|
42
58
|
klass.create(attrs)
|
43
59
|
end
|
44
60
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_auth_proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- QuangTK
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devise
|