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 +4 -4
- data/lib/sinatra/canvas_auth.rb +3 -3
- data/lib/sinatra/canvas_auth/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18c5767aed8a836503fa4c9880faa99e5e3b21c1
|
4
|
+
data.tar.gz: 675e5cbbd76fa389ebd9b63580c5a25454be275d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c002fbf02f0f41127c26aa81d2d7d1cf438ea152e55ec5e8d67d0d103b26aaad69e213d9006b95a1c227e15554e8a6493a031c1a7471f6e269608c3ec914f806
|
7
|
+
data.tar.gz: c1132a29cc37e8a34f0daada820b865629de65f6af4098883852e945737eb2e23dae937c609949b0f34eccbfc8741f3651f3bb747d4e10bb9af3fc71ecaaa15c
|
data/lib/sinatra/canvas_auth.rb
CHANGED
@@ -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)
|
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.
|
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-
|
11
|
+
date: 2016-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|