devise_auth_proxy 0.2.4 → 0.2.9

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: 4eee02acab727c5c249dd73a115f2b0b9c99b899e5065137336026925c7bf839
4
- data.tar.gz: e7645975acffcc8586068e5d4576a42563491b7963b366b54a79a64224431d26
3
+ metadata.gz: 19b6a904880b298b6b11c99dade7c3c5737b556fa79da5cae3a37c1817fbfe63
4
+ data.tar.gz: c8e67957bf8b6a8cd32d4461c7d2dece359675f95d55ae180715a89ede2a6b50
5
5
  SHA512:
6
- metadata.gz: e47ec1f80c8554d065fdee759dc8e9fd19101d4d51644875b2aa5d0e4b13c6d25652e2f7d414ee0c4c21610667e1692af41b44482d5db610c2b01963c1ea3cac
7
- data.tar.gz: 42a3585e6f77b701732c782664487decd489bc1783931b5f08e99069c8dd8c731ded7b7666262bdbb9a8309ee31bdbc14c52880e96ab86bb757cfcc00588c297
6
+ metadata.gz: d1f7ecb5c681ec3e0aa80c3b9e13c789ed3350fc4e1dd5ddc25c7080695fb0b90de4effae4385c00d999c518e2f7de6886804296db5da360115c7569b63f507d
7
+ data.tar.gz: 325eaab1a439257728a123277d547464b308813b0a5d1c12c0c9421425709c37364385111c2723abfa3a4588a502d36546e88ba6f6d183f95ea8b8820ecc2bcc
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devise_auth_proxy (0.2.4)
4
+ devise_auth_proxy (0.2.9)
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
  ```
@@ -4,8 +4,7 @@ require 'devise_auth_proxy/version'
4
4
  module DeviseAuthProxy
5
5
  class << self
6
6
  attr_accessor :env_key, :auto_create, :auto_update, :auth_key,
7
- :attribute_map, :default_role, :logout_service, :logout_url,
8
- :http_cookie
7
+ :attribute_map, :default_role, :logout_service, :logout_url
9
8
  end
10
9
 
11
10
  # request.env key for remote user name
@@ -36,8 +35,6 @@ module DeviseAuthProxy
36
35
  # (it overrides Devise's after_sign_out_path_for method).
37
36
  self.logout_url = '/'
38
37
 
39
- self.http_cookie = nil
40
-
41
38
  def self.configure
42
39
  yield self
43
40
  end
@@ -9,13 +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, DeviseAuthProxy.http_cookie)
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 DeviseAuthProxy.logout_url if DeviseAuthProxy.logout_url
19
18
  super
20
19
  end
21
20
  end
@@ -13,7 +13,6 @@ 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
@@ -1,3 +1,3 @@
1
1
  module DeviseAuthProxy
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -2,12 +2,16 @@ require 'net/http'
2
2
  require 'uri'
3
3
 
4
4
  module Service
5
- class FossIdentity
6
- def logout(path, cookie)
7
- Net::HTTP.post(
5
+ module FossIdentity
6
+ module_function
7
+
8
+ def sign_out(path, cookie)
9
+ resp = Net::HTTP.post(
8
10
  URI(path),
9
- "cookie" => cookie
11
+ nil,
12
+ "Cookie" => cookie
10
13
  )
14
+ resp
11
15
  end
12
16
  end
13
17
  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
4
+ version: 0.2.9
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