devise_auth_proxy 0.2.2 → 0.2.7

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: 6685eda6d5e050116a63de08210c1c2dccea5ae08df98bd0651e56e0992a6626
4
- data.tar.gz: 46eac5cd37ebc5af22748c6bd9596ab1b82fb81ef1c732f010868ca5d46b94a3
3
+ metadata.gz: 1e7771d5273e4be4be1c5c5eb31433b934b8637a585a0c8b52e15699de6fc336
4
+ data.tar.gz: cba53271ec2c75de72e6b8a7d128fabb4a5aecfd6bac6ba1da863ee5a456b8be
5
5
  SHA512:
6
- metadata.gz: f18939adddd8937c114e803945dd69ada09d72b892fcf2d3616be8fbd14b46d4961d5900beecbf15fff50d2ae9a8512d6794ec4a1b4d7b5b75e0c7638f6b6e7a
7
- data.tar.gz: 9f1573f0481cd88971b3c7aeab6d71e1e6bffcf649d09fd9d694fae4ac9fb214332056ba86be45ad5dd35eed1edcaef03c20fb117d3b2f7b15d818bb19935c28
6
+ metadata.gz: 790b2b1f65351ebb37ad0d7c91b9cc444b613741c977fafb80f9ab0820dfe9fc0913c3bcb9653fbbe5394f22d8d0917fcb9a2c767909abe14e2e03fd0369ae27
7
+ data.tar.gz: e47cc166fa4d07e6cd6de3c930e65d81b2a594b54280832b8f36d683724d5bb1200ea191eabd154bac8eb7e0c5027b322b6c6a01a11147cf6364af361a0d116e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devise_auth_proxy (0.2.2)
4
+ devise_auth_proxy (0.2.7)
5
5
  devise
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -32,6 +32,7 @@ Configuration options:
32
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.
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
+ * `logout_service` - String. A service to handle logout session.
35
36
  * `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).
36
37
 
37
38
 
@@ -46,6 +47,7 @@ DeviseAuthProxy.configure do |config|
46
47
  config.auto_update = true
47
48
  config.attribute_map = { email: 'mail' }
48
49
  config.default_role = ['role_name / role_id']
50
+ config.logout_service = '<service name>'
49
51
  config.logout_url = "http://localhost:3000/logout"
50
52
  end
51
53
  ```
@@ -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, :attribute_map, :default_role, :logout_service, :logout_url
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
@@ -34,6 +36,8 @@ module DeviseAuthProxy
34
36
  # (it overrides Devise's after_sign_out_path_for method).
35
37
  self.logout_url = '/'
36
38
 
39
+ self.http_cookie = nil
40
+
37
41
  def self.configure
38
42
  yield self
39
43
  end
@@ -9,15 +9,12 @@ module DeviseAuthProxy
9
9
  unless DeviseAuthProxy.logout_service.nil?
10
10
  case DeviseAuthProxy.logout_service
11
11
  when 'foss_identity'
12
- Service::FossIdentity.logout(DeviseAuthProxy.logout_url, session[:http_cookie])
12
+ Service::FossIdentity.sign_out(DeviseAuthProxy.logout_url, DeviseAuthProxy.http_cookie)
13
13
  else
14
14
  # do nothing
15
15
  end
16
16
  end
17
17
 
18
- session.delete(:http_cookie)
19
-
20
- return DeviseAuthProxy.logout_url if DeviseAuthProxy.logout_url
21
18
  super
22
19
  end
23
20
  end
@@ -13,7 +13,7 @@ module Devise
13
13
 
14
14
  return fail(:invalid) unless resource
15
15
 
16
- session[:http_cookie] = env["HTTP_COOKIE"]
16
+ DeviseAuthProxy.http_cookie = env["HTTP_COOKIE"]
17
17
  # remember_me(resource)
18
18
  success!(resource)
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module DeviseAuthProxy
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.7"
3
3
  end
@@ -3,9 +3,12 @@ require 'uri'
3
3
 
4
4
  module Service
5
5
  module FossIdentity
6
- def logout(path, cookie)
6
+ module_function
7
+
8
+ def sign_out(path, cookie)
7
9
  Net::HTTP.post(
8
10
  URI(path),
11
+ nil,
9
12
  "cookie" => cookie
10
13
  )
11
14
  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.2
4
+ version: 0.2.7
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-30 00:00:00.000000000 Z
11
+ date: 2020-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: devise