bartt-ssl_requirement 1.2.4 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/VERSION +1 -1
- data/bartt-ssl_requirement.gemspec +19 -17
- data/lib/ssl_requirement.rb +3 -4
- data/lib/url_for.rb +1 -1
- metadata +7 -11
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.5
|
@@ -1,47 +1,49 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bartt-ssl_requirement}
|
8
|
-
s.version = "1.2.
|
8
|
+
s.version = "1.2.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["RailsJedi", "David Heinemeier Hansson", "jcnetdev", "bcurren", "bmpercy", "revo", "nathany", "bartt", "Thorben Schr\303\266der"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-03-25}
|
13
13
|
s.description = %q{SSL requirement adds a declarative way of specifying that certain actions should only be allowed to run under SSL, and if they're accessed without it, they should be redirected.}
|
14
14
|
s.email = %q{bart@thecodemill.biz}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"README"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
|
-
"
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
19
|
+
".gitignore",
|
20
|
+
"README",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"bartt-ssl_requirement.gemspec",
|
24
|
+
"init.rb",
|
25
|
+
"lib/ssl_requirement.rb",
|
26
|
+
"lib/url_for.rb",
|
27
|
+
"rails/init.rb",
|
28
|
+
"shoulda_macros/ssl_requirement_macros.rb",
|
29
|
+
"test/ssl_requirement_test.rb",
|
30
|
+
"test/url_for_test.rb"
|
30
31
|
]
|
31
32
|
s.homepage = %q{http://github.com/bartt/ssl_requirement}
|
33
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
32
34
|
s.require_paths = ["lib"]
|
33
|
-
s.rubygems_version = %q{1.3.
|
35
|
+
s.rubygems_version = %q{1.3.6}
|
34
36
|
s.summary = %q{Allow controller actions to force SSL on specific parts of the site.}
|
35
37
|
s.test_files = [
|
36
38
|
"test/ssl_requirement_test.rb",
|
37
|
-
|
39
|
+
"test/url_for_test.rb"
|
38
40
|
]
|
39
41
|
|
40
42
|
if s.respond_to? :specification_version then
|
41
43
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
42
44
|
s.specification_version = 3
|
43
45
|
|
44
|
-
if Gem::Version.new(Gem::
|
46
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
45
47
|
else
|
46
48
|
end
|
47
49
|
else
|
data/lib/ssl_requirement.rb
CHANGED
@@ -60,7 +60,7 @@ module SslRequirement
|
|
60
60
|
def ssl_exceptions(*actions)
|
61
61
|
write_inheritable_array(:ssl_required_except_actions, actions)
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
# To allow SSL for any action pass :all as action like this:
|
65
65
|
# ssl_allowed :all
|
66
66
|
def ssl_allowed(*actions)
|
@@ -83,7 +83,7 @@ module SslRequirement
|
|
83
83
|
|
84
84
|
def ssl_allowed?
|
85
85
|
allowed_actions = (self.class.read_inheritable_attribute(:ssl_allowed_actions) || [])
|
86
|
-
|
86
|
+
|
87
87
|
allowed_actions == [:all] || allowed_actions.include?(action_name.to_sym)
|
88
88
|
end
|
89
89
|
|
@@ -94,13 +94,12 @@ module SslRequirement
|
|
94
94
|
private
|
95
95
|
def ensure_proper_protocol
|
96
96
|
return true if SslRequirement.disable_ssl_check?
|
97
|
-
|
97
|
+
|
98
98
|
if ssl_required? && !request.ssl?
|
99
99
|
redirect_to determine_redirect_url(request, true)
|
100
100
|
flash.keep
|
101
101
|
return false
|
102
102
|
elsif request.ssl? && ssl_allowed?
|
103
|
-
flash.keep
|
104
103
|
return true
|
105
104
|
elsif request.ssl? && !ssl_required?
|
106
105
|
redirect_to determine_redirect_url(request, false)
|
data/lib/url_for.rb
CHANGED
@@ -36,7 +36,7 @@ module ActionDispatch
|
|
36
36
|
# non-ssl host override, then use it
|
37
37
|
def url_for_with_non_ssl_host(options)
|
38
38
|
if !options[:only_path] && !SslRequirement.non_ssl_host.nil?
|
39
|
-
if !(/^https/ =~ (options[:protocol] || @request.protocol))
|
39
|
+
if !(/^https/ =~ (options[:protocol] || @request.try(:protocol)))
|
40
40
|
options.merge! :host => SslRequirement.non_ssl_host
|
41
41
|
end
|
42
42
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bartt-ssl_requirement
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 23
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
7
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
8
|
+
- 5
|
9
|
+
version: 1.2.5
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- RailsJedi
|
@@ -23,7 +22,7 @@ autorequire:
|
|
23
22
|
bindir: bin
|
24
23
|
cert_chain: []
|
25
24
|
|
26
|
-
date: 2011-
|
25
|
+
date: 2011-03-25 00:00:00 -07:00
|
27
26
|
default_executable:
|
28
27
|
dependencies: []
|
29
28
|
|
@@ -36,6 +35,7 @@ extensions: []
|
|
36
35
|
extra_rdoc_files:
|
37
36
|
- README
|
38
37
|
files:
|
38
|
+
- .gitignore
|
39
39
|
- README
|
40
40
|
- Rakefile
|
41
41
|
- VERSION
|
@@ -52,32 +52,28 @@ homepage: http://github.com/bartt/ssl_requirement
|
|
52
52
|
licenses: []
|
53
53
|
|
54
54
|
post_install_message:
|
55
|
-
rdoc_options:
|
56
|
-
|
55
|
+
rdoc_options:
|
56
|
+
- --charset=UTF-8
|
57
57
|
require_paths:
|
58
58
|
- lib
|
59
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
60
|
requirements:
|
62
61
|
- - ">="
|
63
62
|
- !ruby/object:Gem::Version
|
64
|
-
hash: 3
|
65
63
|
segments:
|
66
64
|
- 0
|
67
65
|
version: "0"
|
68
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
67
|
requirements:
|
71
68
|
- - ">="
|
72
69
|
- !ruby/object:Gem::Version
|
73
|
-
hash: 3
|
74
70
|
segments:
|
75
71
|
- 0
|
76
72
|
version: "0"
|
77
73
|
requirements: []
|
78
74
|
|
79
75
|
rubyforge_project:
|
80
|
-
rubygems_version: 1.3.
|
76
|
+
rubygems_version: 1.3.6
|
81
77
|
signing_key:
|
82
78
|
specification_version: 3
|
83
79
|
summary: Allow controller actions to force SSL on specific parts of the site.
|