devise_auth_proxy 0.2.7 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/lib/devise_auth_proxy.rb +6 -2
- data/lib/devise_auth_proxy/helper.rb +3 -1
- data/lib/devise_auth_proxy/manager.rb +17 -1
- data/lib/devise_auth_proxy/strategy.rb +4 -1
- data/lib/devise_auth_proxy/version.rb +1 -1
- data/lib/service/foss_identity.rb +3 -2
- 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
@@ -33,8 +33,9 @@ Configuration options:
|
|
33
33
|
* `auto_update` - Boolean (default: false). Whether to auto-update authenticated user attributes from proxy user attributes.
|
34
34
|
* `default_role` - List (default: []). A list of role default for new user. If your application integrate with CanCan of something like that.
|
35
35
|
* `logout_service` - String. A service to handle logout session.
|
36
|
+
* `skip_session` - Boolean (default: false). To skip storage login session.
|
36
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).
|
37
|
-
|
38
|
+
* `specific_database` - String (default: :disable). For setting a specific database to authenticate.
|
38
39
|
|
39
40
|
Set options in a Rails initializer (e.g., `config/intializers/devise.rb`):
|
40
41
|
|
@@ -48,7 +49,9 @@ DeviseAuthProxy.configure do |config|
|
|
48
49
|
config.attribute_map = { email: 'mail' }
|
49
50
|
config.default_role = ['role_name / role_id']
|
50
51
|
config.logout_service = '<service name>'
|
52
|
+
config.skip_session = true
|
51
53
|
config.logout_url = "http://localhost:3000/logout"
|
54
|
+
config.specific_database = 'login_database'
|
52
55
|
end
|
53
56
|
```
|
54
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
|
-
:
|
8
|
+
:skip_session, :specific_database
|
9
9
|
end
|
10
10
|
|
11
11
|
# request.env key for remote user name
|
@@ -36,7 +36,11 @@ module DeviseAuthProxy
|
|
36
36
|
# (it overrides Devise's after_sign_out_path_for method).
|
37
37
|
self.logout_url = '/'
|
38
38
|
|
39
|
-
|
39
|
+
# To skip storage login session. Default is false.
|
40
|
+
self.skip_session = false
|
41
|
+
|
42
|
+
# To use a specific database for authenticate.
|
43
|
+
self.specific_database = :disable
|
40
44
|
|
41
45
|
def self.configure
|
42
46
|
yield self
|
@@ -9,12 +9,14 @@ module DeviseAuthProxy
|
|
9
9
|
unless DeviseAuthProxy.logout_service.nil?
|
10
10
|
case DeviseAuthProxy.logout_service
|
11
11
|
when 'foss_identity'
|
12
|
-
Service::FossIdentity.sign_out(DeviseAuthProxy.logout_url,
|
12
|
+
Service::FossIdentity.sign_out(DeviseAuthProxy.logout_url, self.request.env['HTTP_COOKIE'])
|
13
13
|
else
|
14
14
|
# do nothing
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
return self.request.env['HTTP_REFERER'] if self.request.env['HTTP_REFERER']
|
19
|
+
|
18
20
|
super
|
19
21
|
end
|
20
22
|
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
|
|
@@ -13,11 +13,14 @@ module Devise
|
|
13
13
|
|
14
14
|
return fail(:invalid) unless resource
|
15
15
|
|
16
|
-
DeviseAuthProxy.http_cookie = env["HTTP_COOKIE"]
|
17
16
|
# remember_me(resource)
|
18
17
|
success!(resource)
|
19
18
|
end
|
20
19
|
|
20
|
+
def store?
|
21
|
+
!DeviseAuthProxy.skip_session
|
22
|
+
end
|
23
|
+
|
21
24
|
end
|
22
25
|
end
|
23
26
|
end
|
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
|