devise_auth_proxy 0.1.17 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11c7215ea33d15a2464c06e51f341320744781cc9252bb8e8c95998399b70520
4
- data.tar.gz: b0fb2b916b62166218cd430ee37ecd2c79f79ea2f84cdcf519d09f240024eeae
3
+ metadata.gz: f48da9026374575851d42fa970741c996e24d095039cd46a044130fda595b9c2
4
+ data.tar.gz: a753b83b27ca69ca517524521d1af05cffb3807a6b5e31168a0b26b35da71dba
5
5
  SHA512:
6
- metadata.gz: bf4fd35a67e0b4a22d9a2ee1c3b5de2075f06e3537c108993c533cec162f0694503677fb34a8adfa744ac202cd8665c28aa5c9a525cbcdb4427d65a596eda4ab
7
- data.tar.gz: c4fbf3bcb1a457ff05f614533fa8dd166fabbb9188eb6d3a8b0d3a7998758b0b09d8f9dce1e4d3066746c74a1a6a5f6cdc67aa6996425a3de3c460621dc77378
6
+ metadata.gz: 714c1ea62a39dab0087f874ce637cb1576c4b142a132e59f17aeed0a870d299f720041573da16f3197d7428ad8cf81dddb4979ea42dc903ba99c35b6fb3df1c4
7
+ data.tar.gz: 4f3bf097a00d7610e902a789a80f03adce1fe790ca71947adeb5f5273e042afe2ca9ee97b25b316757e672e8136fcb8cb08fec976eae68bfd33bd661c95b8140
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devise_auth_proxy (0.1.17)
4
+ devise_auth_proxy (0.2.0)
5
5
  devise
6
6
 
7
7
  GEM
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
- Configuaration options:
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
  ```
@@ -0,0 +1,11 @@
1
+ module DeviseAuthProxy
2
+ module Helper
3
+
4
+ # Modify session controller after user log out.
5
+ # To redirect user to a custom url.
6
+ def after_sign_out_path_for(resource_or_scope)
7
+ return DeviseAuthProxy.logout_url if DeviseAuthProxy.logout_url
8
+ super
9
+ end
10
+ end
11
+ end
@@ -37,6 +37,8 @@ module DeviseAuthProxy
37
37
  password_confirmation: random_password,
38
38
  roles: DeviseAuthProxy.default_role
39
39
  })
40
+
41
+
40
42
  klass.create(attrs)
41
43
  end
42
44
 
@@ -12,6 +12,9 @@ module Devise
12
12
  resource = mapping.to.find_for_auth_proxy_authentication(env)
13
13
 
14
14
  return fail(:invalid) unless resource
15
+
16
+ # remember_me(resource)
17
+ success!(resource)
15
18
  end
16
19
 
17
20
  end
@@ -1,3 +1,3 @@
1
1
  module DeviseAuthProxy
2
- VERSION = "0.1.17"
2
+ VERSION = "0.2.0"
3
3
  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.1.17
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - QuangTK
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-29 00:00:00.000000000 Z
11
+ date: 2020-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise
@@ -44,6 +44,7 @@ files:
44
44
  - bin/setup
45
45
  - devise_auth_proxy.gemspec
46
46
  - lib/devise_auth_proxy.rb
47
+ - lib/devise_auth_proxy/helper.rb
47
48
  - lib/devise_auth_proxy/manager.rb
48
49
  - lib/devise_auth_proxy/model.rb
49
50
  - lib/devise_auth_proxy/strategy.rb