sinatra-canvas_auth 0.0.2 → 0.0.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: e4322afa214fc4fe87e54c4fd913d3cc99a3cf23
4
- data.tar.gz: e40a8552e6b0d15a969fae4e7e99be4cfc0f229c
3
+ metadata.gz: 18c5767aed8a836503fa4c9880faa99e5e3b21c1
4
+ data.tar.gz: 675e5cbbd76fa389ebd9b63580c5a25454be275d
5
5
  SHA512:
6
- metadata.gz: 055c408a48322b61801ebb80efca2c1c39f8da80508dc4fa1451042f3d1c9355650778bd9661515a79f364af1907ea97e70bf4cf2817fc4018d3a4c297eb0050
7
- data.tar.gz: 966567ec2d630060bd042780341276189ff9db040c44120e5a85c88525df142d4d001a0422f064e6fb22d15c3c643d643f550d6def3a8c930a1d28abb8bc5e23
6
+ metadata.gz: c002fbf02f0f41127c26aa81d2d7d1cf438ea152e55ec5e8d67d0d103b26aaad69e213d9006b95a1c227e15554e8a6493a031c1a7471f6e269608c3ec914f806
7
+ data.tar.gz: c1132a29cc37e8a34f0daada820b865629de65f6af4098883852e945737eb2e23dae937c609949b0f34eccbfc8741f3651f3bb747d4e10bb9af3fc71ecaaa15c
@@ -92,7 +92,7 @@ module Sinatra
92
92
  # Redirect unauthenticated/unauthorized users before hitting app routes
93
93
  app.before do
94
94
  current_path = "#{request.env['SCRIPT_NAME']}#{request.env['PATH_INFO']}"
95
- if CanvasAuth.auth_path?(self.settings, current_path)
95
+ if CanvasAuth.auth_path?(self.settings, current_path, request.env['SCRIPT_NAME'])
96
96
  if session['user_id'].nil?
97
97
  redirect "#{request.env['SCRIPT_NAME']}#{settings.login_path}?state=#{current_path}"
98
98
  elsif self.respond_to?(:authorized) && !authorized
@@ -103,12 +103,12 @@ module Sinatra
103
103
  end
104
104
 
105
105
  # Should the current path ask for authentication or is it public?
106
- def self.auth_path?(app, current_path)
106
+ def self.auth_path?(app, current_path, script_name = '')
107
107
  exempt_paths = [ app.login_path, app.token_path, app.logout_path,
108
108
  app.logout_redirect, app.unauthorized_redirect ]
109
109
 
110
110
  app.auth_paths.select{ |p| current_path.match(p) }.any? &&
111
- !exempt_paths.include?(current_path)
111
+ !exempt_paths.map{|p| File.join(script_name, p)}.include?(current_path)
112
112
  end
113
113
 
114
114
  def self.merge_defaults(app)
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module CanvasAuth
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-canvas_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Connor Ford
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-16 00:00:00.000000000 Z
11
+ date: 2016-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler