stormpath-rails 2.5.0 → 2.5.1

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
  SHA1:
3
- metadata.gz: 88eef9432856e3264850f71a1cfb8c436e351645
4
- data.tar.gz: 26ec1cf47d26e18ebd6a87fac8a9004fc866d15a
3
+ metadata.gz: 0d0797044a0112e465739c5e300389df00665dec
4
+ data.tar.gz: 172831a98c3790007f27a2b35d14da44b04e8a37
5
5
  SHA512:
6
- metadata.gz: 189c34db894a9640d635fbd00f87206e8cbad70c471e20d8e0dbc003f0a932115e9bd963db93d704bc54c007421efa51ff65860d06ea862e847ed86a1ec60514
7
- data.tar.gz: 092c1446f6cf3369d4a8517ea0f297ec94ec10c62116a50d14f71de4e1306b74c73c8e77a5c46de62a3a1678c484ff56fb55b8bae4a3de86514b4582ec12a9ae
6
+ metadata.gz: 834f464ef9822c655517d97095431c8482cf8e4ba88c3e317e6e36d25545c46dbe5ab1d3cf49c91e96540599d37cc3ed304631aeb9a7aafa1c8fde304681a0c3
7
+ data.tar.gz: 22203d6038aa53ef45ec0ba458c81d2d031e93ec12d7ca4cd66834aec57e9ff0ef603f2857853ecf17dc1ac7902c298a9bcfe51152e2a3098f1f5cba79d3cd1b
data/.travis.yml CHANGED
@@ -8,7 +8,7 @@ before_install:
8
8
  install:
9
9
  - gem install bundler
10
10
  - bundle install --jobs=3 --retry=3
11
- - test -z "$BUILD_DOCS" || pip install --user sphinx
11
+ - test -z "$BUILD_DOCS" || pip install --user -r requirements.txt
12
12
  script:
13
13
  - travis_retry rake
14
14
  - test -z "$BUILD_DOCS" || cd docs
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Stormpath Rails Changelog
2
2
  ============================
3
3
 
4
+ Version 2.5.1
5
+ -------------
6
+ Released on Jan 19, 2017
7
+ - Fix bug with callback uri not being set properly on IDSite logout
8
+ - Rewrite the IDSite authentication workflow
9
+
4
10
  Version 2.5.0
5
11
  -------------
6
12
  Released on Jan 09, 2017
data/README.md CHANGED
@@ -16,7 +16,7 @@ Add the stormpath-rails integration gem to your Gemfile.
16
16
  Stormpath is currently in beta so it is necessary to include the gem version:
17
17
 
18
18
  ```ruby
19
- gem 'stormpath-rails', '~> 2.5.0'
19
+ gem 'stormpath-rails', '~> 2.5.1'
20
20
  ```
21
21
 
22
22
  Bundle the Gemfile
@@ -175,6 +175,8 @@ Stormpath::Rails::Profile::ShowController
175
175
  Stormpath::Rails::Oauth2::NewController
176
176
  Stormpath::Rails::Oauth2::CreateController
177
177
 
178
+ Stormpath::Rails::IdSiteCallback::NewController
179
+
178
180
  Stormpath::Rails::SocialController
179
181
  Stormpath::Rails::Facebook::CreateController
180
182
  Stormpath::Rails::Github::CreateController
@@ -1,15 +1,17 @@
1
1
  module Stormpath
2
2
  module Rails
3
- module IdSiteLogin
3
+ module IdSiteCallback
4
4
  class NewController < BaseController
5
- before_action :require_no_authentication!
6
5
 
7
6
  def call
8
7
  begin
9
- result = Stormpath::Rails::Client.application.handle_id_site_callback(request.url)
10
- account = Stormpath::Rails::Client.client.accounts.get(result.account_href)
11
- login_the_account(account)
12
- respond_with_success(account)
8
+ if id_site_result.status == 'LOGOUT'
9
+ TokenAndCookiesCleaner.new(cookies).remove
10
+ else
11
+ login_the_account
12
+ end
13
+
14
+ respond_with_success
13
15
  rescue Stormpath::Error, JWT::VerificationError => error
14
16
  respond_with_error(error)
15
17
  end
@@ -17,7 +19,7 @@ module Stormpath
17
19
 
18
20
  private
19
21
 
20
- def login_the_account(account)
22
+ def login_the_account
21
23
  AccountLoginWithStormpathToken.new(
22
24
  cookies, account,
23
25
  Stormpath::Rails::Client.application,
@@ -25,10 +27,17 @@ module Stormpath
25
27
  ).call
26
28
  end
27
29
 
28
- def respond_with_success(account)
29
- respond_to do |format|
30
- format.html { redirect_to login_redirect_route, notice: 'Successfully signed in' }
31
- format.json { render json: AccountSerializer.to_h(account) }
30
+ def respond_with_success
31
+ if id_site_result.status == 'LOGOUT'
32
+ respond_to do |format|
33
+ format.html { redirect_to stormpath_config.web.logout.next_uri, notice: 'Successfully logged out' }
34
+ format.json { head :no_content }
35
+ end
36
+ else
37
+ respond_to do |format|
38
+ format.html { redirect_to login_redirect_route, notice: 'Successfully signed in' }
39
+ format.json { render json: AccountSerializer.to_h(account) }
40
+ end
32
41
  end
33
42
  end
34
43
 
@@ -51,6 +60,14 @@ module Stormpath
51
60
  stormpath_config.web.login.next_uri
52
61
  end
53
62
  end
63
+
64
+ def id_site_result
65
+ @id_site_result ||= Stormpath::Rails::Client.application.handle_id_site_callback(request.url)
66
+ end
67
+
68
+ def account
69
+ @account ||= Stormpath::Rails::Client.client.accounts.get(id_site_result.account_href)
70
+ end
54
71
  end
55
72
  end
56
73
  end
@@ -6,7 +6,7 @@ module Stormpath
6
6
 
7
7
  def call
8
8
  if stormpath_config.web.id_site.enabled
9
- redirect_to(callback_url)
9
+ redirect_to(stormpath_id_site_login_url)
10
10
  elsif organization_unresolved?
11
11
  redirect_to(parent_login_url)
12
12
  else
@@ -19,7 +19,7 @@ module Stormpath
19
19
 
20
20
  private
21
21
 
22
- def callback_url
22
+ def stormpath_id_site_login_url
23
23
  Stormpath::Rails::Client.application.create_id_site_url(
24
24
  callback_uri: id_site_result_url,
25
25
  path: Stormpath::Rails.config.web.id_site.login_uri
@@ -27,11 +27,7 @@ module Stormpath
27
27
  end
28
28
 
29
29
  def parent_login_url
30
- UrlBuilder.create(
31
- req,
32
- stormpath_config.web.domain_name,
33
- stormpath_config.web.login.uri
34
- )
30
+ UrlBuilder.create(req, stormpath_config.web.domain_name, stormpath_config.web.login.uri)
35
31
  end
36
32
  end
37
33
  end
@@ -5,7 +5,9 @@ module Stormpath
5
5
  BEARER_PATTERN = /^Bearer /
6
6
 
7
7
  def call
8
- if bearer_authorization_header?
8
+ if stormpath_config.web.id_site.enabled
9
+ return redirect_to(stormpath_id_site_logout_url)
10
+ elsif bearer_authorization_header?
9
11
  DeleteAccessToken.call(bearer_access_token)
10
12
  else
11
13
  TokenAndCookiesCleaner.new(cookies).remove
@@ -36,6 +38,11 @@ module Stormpath
36
38
  format.json { render nothing: true, status: 200 }
37
39
  end
38
40
  end
41
+
42
+ def stormpath_id_site_logout_url
43
+ Stormpath::Rails::Client.application.create_id_site_url(callback_uri: id_site_result_url,
44
+ logout: true)
45
+ end
39
46
  end
40
47
  end
41
48
  end
@@ -5,7 +5,7 @@ module Stormpath
5
5
 
6
6
  def call
7
7
  if stormpath_config.web.id_site.enabled
8
- redirect_to(callback_url)
8
+ redirect_to(stormpath_id_site_register_url)
9
9
  elsif signed_in?
10
10
  redirect_to(root_path)
11
11
  elsif organization_unresolved?
@@ -20,7 +20,7 @@ module Stormpath
20
20
 
21
21
  private
22
22
 
23
- def callback_url
23
+ def stormpath_id_site_register_url
24
24
  Stormpath::Rails::Client.application.create_id_site_url(
25
25
  callback_uri: id_site_result_url,
26
26
  path: Stormpath::Rails.config.web.id_site.register_uri
data/docs/changelog.rst CHANGED
@@ -6,6 +6,13 @@ Change Log
6
6
 
7
7
  Gem changes until version 2.0.1, in descending order.
8
8
 
9
+ Version 2.5.1
10
+ -------------
11
+ Released on Jan 19, 2017
12
+ - Fix bug with callback uri not being set properly on IDSite logout
13
+ - Rewrite the IDSite authentication workflow
14
+
15
+
9
16
  Version 2.5.0
10
17
  -------------
11
18
  Released on Jan 09, 2017
@@ -205,7 +205,7 @@ stormpath:
205
205
  # Stormpath handled social login, webhooks, and other messages from Stormpath.
206
206
  callback:
207
207
  enabled: true
208
- uri: "/stormpathCallback"
208
+ uri: "/id_site_result"
209
209
 
210
210
  # Social login configuration. This defines the callback URIs for OAuth
211
211
  # flows, and the scope that is requested of each provider. Some providers
@@ -20,8 +20,7 @@ module Stormpath
20
20
  'github#create' => 'stormpath/rails/github/create#call',
21
21
  'google#create' => 'stormpath/rails/google/create#call',
22
22
  'linkedin#create' => 'stormpath/rails/linkedin/create#call',
23
- 'id_site_login#new' => 'stormpath/rails/id_site_login/new#call',
24
- 'id_site_logout#new' => 'stormpath/rails/id_site_logout/new#call'
23
+ 'id_site_callback#new' => 'stormpath/rails/id_site_callback/new#call'
25
24
  }.freeze
26
25
 
27
26
  def stormpath_rails_routes(actions: {})
@@ -90,10 +89,9 @@ module Stormpath
90
89
  get Stormpath::Rails.config.web.social.linkedin.uri => actions['linkedin#create'], as: :linkedin_callback
91
90
  end
92
91
 
93
- # ID SITE LOGIN
94
- if Stormpath::Rails.config.web.id_site.enabled
95
- get '/id_site_result' => actions['id_site_login#new'], as: :id_site_result
96
- get '/logout_id_site' => actions['id_site_logout#new'], as: :logout_id_site
92
+ # CALLBACK
93
+ if Stormpath::Rails.config.web.callback.enabled
94
+ get Stormpath::Rails.config.web.callback.uri => actions['id_site_callback#new'], as: :id_site_result
97
95
  end
98
96
  end
99
97
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Stormpath
3
3
  module Rails
4
- VERSION = '2.5.0'.freeze
4
+ VERSION = '2.5.1'.freeze
5
5
  end
6
6
  end
data/requirements.txt ADDED
@@ -0,0 +1,22 @@
1
+ alabaster==0.7.7
2
+ argh==0.26.1
3
+ Babel==2.2.0
4
+ backports-abc==0.4
5
+ backports.ssl-match-hostname==3.5.0.1
6
+ certifi==2016.2.28
7
+ docutils==0.12
8
+ Jinja2==2.8
9
+ livereload==2.4.1
10
+ MarkupSafe==0.23
11
+ pathtools==0.1.2
12
+ port-for==0.3.1
13
+ Pygments==2.1.3
14
+ pytz==2016.1
15
+ PyYAML==3.11
16
+ singledispatch==3.4.0.3
17
+ six==1.10.0
18
+ snowballstemmer==1.2.1
19
+ Sphinx==1.3.6
20
+ sphinx-autobuild==0.6.0
21
+ tornado==4.3
22
+ watchdog==0.8.3
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stormpath-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nenad Nikolic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-09 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: stormpath-sdk
@@ -119,8 +119,7 @@ files:
119
119
  - app/controllers/stormpath/rails/forgot_password/new_controller.rb
120
120
  - app/controllers/stormpath/rails/github/create_controller.rb
121
121
  - app/controllers/stormpath/rails/google/create_controller.rb
122
- - app/controllers/stormpath/rails/id_site_login/new_controller.rb
123
- - app/controllers/stormpath/rails/id_site_logout/new_controller.rb
122
+ - app/controllers/stormpath/rails/id_site_callback/new_controller.rb
124
123
  - app/controllers/stormpath/rails/linkedin/create_controller.rb
125
124
  - app/controllers/stormpath/rails/login/create_controller.rb
126
125
  - app/controllers/stormpath/rails/login/new_controller.rb
@@ -265,6 +264,7 @@ files:
265
264
  - lib/stormpath/rails/routing_constraint.rb
266
265
  - lib/stormpath/rails/social.rb
267
266
  - lib/stormpath/rails/version.rb
267
+ - requirements.txt
268
268
  - stormpath-rails.gemspec
269
269
  homepage: http://www.stormpath.com
270
270
  licenses: []
@@ -1,19 +0,0 @@
1
- module Stormpath
2
- module Rails
3
- module IdSiteLogout
4
- class NewController < BaseController
5
- def call
6
- TokenAndCookiesCleaner.new(cookies).remove
7
- redirect_to callback_url
8
- end
9
-
10
- private
11
-
12
- def callback_url
13
- Stormpath::Rails::Client.application.create_id_site_url(callback_uri: root_url,
14
- logout: true)
15
- end
16
- end
17
- end
18
- end
19
- end