integration_pal 0.2.0 → 0.2.1

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: 74caae0c072309e715b66419e74685509269ea75
4
- data.tar.gz: 4091c879c8b127dc76941f33826b69747f06511e
3
+ metadata.gz: de0868d260b1c8d55bd3015f9edd5e13583f8881
4
+ data.tar.gz: 88acaaebcfd357a5ee94f12323495d3d56695eb7
5
5
  SHA512:
6
- metadata.gz: ebd076d4c5f3e5d5a72babca42402fedf3f558d3696f9af342edae583dace2642c4aef323a1a352d6b25f4d9fdd156ca92bdabfffc7181a15541c7f401d1868f
7
- data.tar.gz: '0987932589a5431135b3625f491f01df1ce6d08ec3ed481c2584579319092e58fd4b1f775694fb7862670a885c796263b3973c1416d753d1ac1decc2c9e562f9'
6
+ metadata.gz: bd103d50053894e2bc7794de0e82838573cf9b69270efcda721525b10dedc89026891b62decd9c08365d7654be77255ac8ac0f0bfeca5ccbad82348341d8ab0d
7
+ data.tar.gz: 8068c9446f59e8eb8a3afcfbce33d53fbdc667aeabb842ee2004eb851c4aef74c6179c373f457651f5d25760a08cc51a532691b65ad00859bcac73639924895a
@@ -1,13 +1,9 @@
1
1
  module IntegrationPal
2
2
  class ApplicationController < ActionController::Base
3
3
  protect_from_forgery with: :exception
4
- before_action :require_user, unless: :skip_authentication?
4
+ before_action :authenticate!
5
5
 
6
- def skip_authentication?
7
- return false
8
- end
9
-
10
- def require_user
6
+ def authenticate!
11
7
  # pretend to be logged in; you can still go directly to /login if you want to test the SAML flow
12
8
  session[:saml_username] ||= ENV['USER'] if Rails.env.in?(%w(development test))
13
9
  redirect_to saml2_login_url unless session[:saml_username]
@@ -38,10 +38,7 @@ module IntegrationPal
38
38
  end
39
39
 
40
40
  protect_from_forgery except: [:create]
41
-
42
- def skip_authentication?
43
- true
44
- end
41
+ skip_before_action :authenticate!
45
42
 
46
43
  def new
47
44
  authn_request = self.class.sp_metadata.initiate_authn_request(self.class.idp_metadata)
@@ -62,6 +59,11 @@ module IntegrationPal
62
59
  redirect_to root_url
63
60
  end
64
61
 
62
+ def logout
63
+ reset_session
64
+ redirect_to root_url
65
+ end
66
+
65
67
  def metadata
66
68
  render xml: self.class.sp_metadata.to_xml
67
69
  end
@@ -17,7 +17,7 @@
17
17
  </ul>
18
18
 
19
19
  <ul class="nav navbar-nav navbar-right">
20
- <li><%= link_to 'Logout', logout_url.gsub(IntegrationPal::Engine.mounted_path, '') if logout_url.present? %></li>
20
+ <li><%= link_to 'Logout', saml2_logout_url %></li>
21
21
  </ul>
22
22
  </div>
23
23
  </div>
data/config/routes.rb CHANGED
@@ -3,6 +3,7 @@ IntegrationPal::Engine.routes.draw do
3
3
  get 'login' => 'saml#new'
4
4
  post 'login' => 'saml#create'
5
5
  get 'SAML2' => 'saml#metadata', as: 'meta'
6
+ get 'logout' => 'saml#logout'
6
7
  end
7
8
 
8
9
  root to: 'workers#index'
@@ -1,3 +1,3 @@
1
1
  module IntegrationPal
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: integration_pal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Tanner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-18 00:00:00.000000000 Z
11
+ date: 2018-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails