devise_auth_proxy 0.1.21 → 0.2.4
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 +8 -1
- data/lib/devise_auth_proxy/helper.rb +11 -0
- data/lib/devise_auth_proxy/strategy.rb +1 -0
- data/lib/devise_auth_proxy/version.rb +1 -1
- data/lib/service/foss_identity.rb +13 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4eee02acab727c5c249dd73a115f2b0b9c99b899e5065137336026925c7bf839
|
4
|
+
data.tar.gz: e7645975acffcc8586068e5d4576a42563491b7963b366b54a79a64224431d26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e47ec1f80c8554d065fdee759dc8e9fd19101d4d51644875b2aa5d0e4b13c6d25652e2f7d414ee0c4c21610667e1692af41b44482d5db610c2b01963c1ea3cac
|
7
|
+
data.tar.gz: 42a3585e6f77b701732c782664487decd489bc1783931b5f08e99069c8dd8c731ded7b7666262bdbb9a8309ee31bdbc14c52880e96ab86bb757cfcc00588c297
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -24,12 +24,14 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
Invoke hook
|
26
26
|
* Add `:auth_proxy_authenticatable` symbol to `devise` statement in User model, before other authentication strategies (e.g., `:database_authenticatable`).
|
27
|
+
* Add `include DeviseAuthProxy::Helper` to ApplicationController to override `after_sign_out_path_for` of devise if you want to modify the redirect url after sign out.
|
27
28
|
|
28
|
-
|
29
|
+
Configuration options:
|
29
30
|
* `env_key` - String (default: 'AUTH_PROXY'). Request environment key for the proxy user id.
|
30
31
|
* `attribute_map` - Hash (default: {}). Map of User model attributes to request environment keys for updating the local user when auto-creation is enabled.
|
31
32
|
* `auto_create` - Boolean (default: false). Whether to auto-create a local user from the proxy user attributes. Note: Also requires adding the Warden callbacks as shown below.
|
32
33
|
* `auto_update` - Boolean (default: false). Whether to auto-update authenticated user attributes from proxy user attributes.
|
34
|
+
* `default_role` - List (default: []). A list of role default for new user. If your application integrate with CanCan of something like that.
|
33
35
|
* `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).
|
34
36
|
|
35
37
|
|
@@ -43,6 +45,7 @@ DeviseAuthProxy.configure do |config|
|
|
43
45
|
config.auto_create = true
|
44
46
|
config.auto_update = true
|
45
47
|
config.attribute_map = { email: 'mail' }
|
48
|
+
config.default_role = ['role_name / role_id']
|
46
49
|
config.logout_url = "http://localhost:3000/logout"
|
47
50
|
end
|
48
51
|
```
|
data/lib/devise_auth_proxy.rb
CHANGED
@@ -3,7 +3,9 @@ require 'devise_auth_proxy/version'
|
|
3
3
|
|
4
4
|
module DeviseAuthProxy
|
5
5
|
class << self
|
6
|
-
attr_accessor :env_key, :auto_create, :auto_update, :auth_key,
|
6
|
+
attr_accessor :env_key, :auto_create, :auto_update, :auth_key,
|
7
|
+
:attribute_map, :default_role, :logout_service, :logout_url,
|
8
|
+
:http_cookie
|
7
9
|
end
|
8
10
|
|
9
11
|
# request.env key for remote user name
|
@@ -26,11 +28,16 @@ module DeviseAuthProxy
|
|
26
28
|
# Set default role for new user.
|
27
29
|
self.default_role = []
|
28
30
|
|
31
|
+
# Set the service using to logout.
|
32
|
+
self.logout_service = nil
|
33
|
+
|
29
34
|
# Settings for redirecting to the remote user logout URL
|
30
35
|
# Enable by including DeviseAuthProxy::Controllers::Helpers in ApplicationController
|
31
36
|
# (it overrides Devise's after_sign_out_path_for method).
|
32
37
|
self.logout_url = '/'
|
33
38
|
|
39
|
+
self.http_cookie = nil
|
40
|
+
|
34
41
|
def self.configure
|
35
42
|
yield self
|
36
43
|
end
|
@@ -1,9 +1,20 @@
|
|
1
|
+
require 'service/foss_identity'
|
2
|
+
|
1
3
|
module DeviseAuthProxy
|
2
4
|
module Helper
|
3
5
|
|
4
6
|
# Modify session controller after user log out.
|
5
7
|
# To redirect user to a custom url.
|
6
8
|
def after_sign_out_path_for(resource_or_scope)
|
9
|
+
unless DeviseAuthProxy.logout_service.nil?
|
10
|
+
case DeviseAuthProxy.logout_service
|
11
|
+
when 'foss_identity'
|
12
|
+
Service::FossIdentity.logout(DeviseAuthProxy.logout_url, DeviseAuthProxy.http_cookie)
|
13
|
+
else
|
14
|
+
# do nothing
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
7
18
|
return DeviseAuthProxy.logout_url if DeviseAuthProxy.logout_url
|
8
19
|
super
|
9
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise_auth_proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- QuangTK
|
@@ -49,6 +49,7 @@ files:
|
|
49
49
|
- lib/devise_auth_proxy/model.rb
|
50
50
|
- lib/devise_auth_proxy/strategy.rb
|
51
51
|
- lib/devise_auth_proxy/version.rb
|
52
|
+
- lib/service/foss_identity.rb
|
52
53
|
homepage: https://github.com/me0den/devise_auth_proxy
|
53
54
|
licenses:
|
54
55
|
- MIT
|