devise_auth_proxy 0.2.1 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69eb82aa5afcfbafa90b4c4e1cbfca6a55e07b9ae8ed5405980b06b5eea7496b
4
- data.tar.gz: 33a6e309d5d40efe6aac23b0f81f1d9cfe279e63374054e93bca45949ca15aa0
3
+ metadata.gz: a7b8c06f1cfc1c095e593694745b2c94df0248d34636bf4a7a360dab88b374d3
4
+ data.tar.gz: 76e606ebdc8fc7c8042058429769aeeb9100f6b8ab9b7898a30d8a867e3b10f9
5
5
  SHA512:
6
- metadata.gz: fde955533784af6929e8ba6c9e99e9601ed8bd6f849ef4cf5605728ba8f7ca680785c570fec559f4e3d4b580be11d3277d35c06818cf178d0f17bc881a88b9e6
7
- data.tar.gz: 5bc91de4d5784cad0f582693481dc7dc47a7726693bfb7fe009cb687757d176bf57ecf9885d775c6e85cf7536f38818d338f26197c99b4522e1cddb114523a86
6
+ metadata.gz: 8c10add109b98d5f2a052b1aea8011f277cea8f07674454dc8c47fc3ae85038d2905b0f519397665c67f032e51d7e09916f8446e82eb5aae014d6424d93a35a2
7
+ data.tar.gz: 65854419db6ccbc644c0bf456c5ea8a6f605ff3eda9a4be3b4269aaa3e79304fa93ae1cbad0846d7bb4f00789147b693d89030e772be988b2fe65b75b5cef4a9
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devise_auth_proxy (0.2.1)
4
+ devise_auth_proxy (0.2.6)
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
@@ -1,3 +1,5 @@
1
+ require 'service/foss_identity'
2
+
1
3
  module DeviseAuthProxy
2
4
  module Helper
3
5
 
@@ -7,14 +9,12 @@ module DeviseAuthProxy
7
9
  unless DeviseAuthProxy.logout_service.nil?
8
10
  case DeviseAuthProxy.logout_service
9
11
  when 'foss_identity'
10
- Service::FossIdentity.logout(DeviseAuthProxy.logout_url, session[:http_cookie])
12
+ Service::FossIdentity.sign_out(DeviseAuthProxy.logout_url, DeviseAuthProxy.http_cookie)
11
13
  else
12
14
  # do nothing
13
15
  end
14
16
  end
15
17
 
16
- session.delete(:http_cookie)
17
-
18
18
  return DeviseAuthProxy.logout_url if DeviseAuthProxy.logout_url
19
19
  super
20
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.1"
2
+ VERSION = "0.2.6"
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,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.2.1
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - QuangTK