doorkeeper_sso_client 0.4.2 → 0.4.3

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
  SHA1:
3
- metadata.gz: fc3783f708d98bac384c9dc40534defe5f17df63
4
- data.tar.gz: dbfa104f88e0302c70503537b8acecca414ffd74
3
+ metadata.gz: 47c9f11b2efdd8c4ed007aa6390d87ff1c936516
4
+ data.tar.gz: e69fd047adc6b6a2641e331152499ebb4965f9cf
5
5
  SHA512:
6
- metadata.gz: 7cefa864f3a0e0c57b09ef676af06d85462bfdb1d5b7a983bdda91d86dbe32efb49adcbf3dc4662079cad83a178aad626d268bede4e2551a12f9aed11c4fd340
7
- data.tar.gz: 810515abf3aa8ddbd63fe9ef2f949a6c1878343bcd482886d17b9e2edbf5dd2d4c801adcafd1413f1c12761910f35cfe46f90c57424aaa2a763edf6c4605eb18
6
+ metadata.gz: 701069b5f57bbc69ce250d5baef0a714bfad5910c4a04bb324fdaaede4aecf5bad5f1dc38b2e15e21774bf6e2bd4910bfa91a61003d1f318159f28747b274e37
7
+ data.tar.gz: 2af04057c7c01621c6b507ab5c5a37abff79d45c1cb85afd8da09dc6cebb6c3e911456c98fd90704ef81a7c58f335d22e162136afe3826cdd70488ea61b29d07
@@ -43,17 +43,13 @@ module DoorkeeperSsoClient
43
43
  scope = ::Devise::Mapping.find_scope!(resource_or_scope)
44
44
  return scope == scope_sym
45
45
  end
46
- METHODS
47
46
 
48
- unless options[:skip_devise_hook]
49
- class_eval <<-METHODS, __FILE__, __LINE__ + 1
50
- def authenticate_#{scope}!
51
- store_location_for(:#{scope}, request.original_url)
52
- validate_passport!
53
- redirect_to DoorkeeperSsoClient::Config.oauth_login_path unless #{scope}_signed_in?
54
- end
55
- METHODS
56
- end
47
+ def authenticate_#{scope}!
48
+ store_location_for(:#{scope}, request.original_url)
49
+ validate_passport!
50
+ redirect_to DoorkeeperSsoClient::Config.oauth_login_path + "?origin=" + URI.encode(request.original_url) unless #{scope}_signed_in?
51
+ end
52
+ METHODS
57
53
  end
58
54
  end
59
55
  end # ControllerHelpers
@@ -1,3 +1,3 @@
1
1
  module DoorkeeperSsoClient
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
@@ -37,8 +37,8 @@ RSpec.describe "DoorkeeperSsoClient::Mixins::Devise::ControllerHelpers DeviseHoo
37
37
  expect(controller.user_signed_in?).to be_falsey
38
38
  end
39
39
 
40
- it "redirects to Omniauth strategy" do
41
- expect(response).to redirect_to("http://test.host/auth/doorkeeper_sso")
40
+ it "redirects to Omniauth strategy with origin" do
41
+ expect(response).to redirect_to("http://test.host/auth/doorkeeper_sso?origin=http://test.host/anonymous")
42
42
  end
43
43
 
44
44
  it "stores origin location" do
@@ -97,48 +97,4 @@ RSpec.describe "DoorkeeperSsoClient::Mixins::Devise::ControllerHelpers DeviseHoo
97
97
  expect(controller.session['passport_id']).to be_nil
98
98
  end
99
99
  end
100
- end
101
-
102
-
103
-
104
- RSpec.describe "DoorkeeperSsoClient::Mixins::Devise::ControllerHelpers SkipDeviseHook", :type => :controller do
105
- controller(ApplicationController) do
106
- include DoorkeeperSsoClient::Mixins::Devise::ControllerHelpers
107
-
108
- activate_sso :user, :skip_devise_hook => true
109
- before_filter :authenticate_user!
110
-
111
- def index
112
- render nothing: :true
113
- end
114
- end
115
-
116
- let(:passport) { Fabricate('DoorkeeperSsoClient::Passport', identity: Fabricate(:user)) }
117
- let(:user) { passport.identity }
118
-
119
- before(:each) do
120
- @request.env["devise.mapping"] = Devise.mappings[:user]
121
- sign_in user
122
- get :index
123
- end
124
-
125
- describe "#validate_passport!" do
126
- context "with valid passport" do
127
- it "remain signed in" do
128
- expect(controller.user_signed_in?).to be_truthy
129
- end
130
- end
131
-
132
- context "with invalid passport" do
133
- let(:passport) { Fabricate('DoorkeeperSsoClient::Passport', identity: Fabricate(:user), revoked_at: Time.now, revoke_reason: :logout ) }
134
- it "remain signed in" do
135
- expect(controller.user_signed_in?).to be_truthy
136
- end
137
-
138
- it "sign out when manually validate_passport!" do
139
- controller.validate_passport!
140
- expect(controller.user_signed_in?).to be_falsey
141
- end
142
- end
143
- end
144
100
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doorkeeper_sso_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Wong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-16 00:00:00.000000000 Z
11
+ date: 2015-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth