bartt-ssl_requirement 1.2.5 → 1.2.6
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.
- data/README +5 -0
- data/VERSION +1 -1
- data/bartt-ssl_requirement.gemspec +4 -4
- data/lib/ssl_requirement.rb +3 -3
- metadata +9 -4
data/README
CHANGED
@@ -80,6 +80,11 @@ You are able to turn disable ssl redirects by adding the following environment c
|
|
80
80
|
|
81
81
|
SslRequirement.disable_ssl_check = true
|
82
82
|
|
83
|
+
You are able to the change the status code (defaults to 302) of the redirect by
|
84
|
+
addng the following to the environment configuration file:
|
85
|
+
|
86
|
+
SslRequirement.redirect_status = :moved_permanently
|
87
|
+
|
83
88
|
P.S.: Beware when you include the SslRequirement module. At the time of
|
84
89
|
inclusion, it'll add the before_filter that validates the declarations. Some
|
85
90
|
times you'll want to run other before_filters before that. They should then be
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.2.
|
1
|
+
1.2.6
|
@@ -5,11 +5,11 @@
|
|
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.6"
|
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-05-26}
|
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 = [
|
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.homepage = %q{http://github.com/bartt/ssl_requirement}
|
33
33
|
s.rdoc_options = ["--charset=UTF-8"]
|
34
34
|
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.3.
|
35
|
+
s.rubygems_version = %q{1.3.7}
|
36
36
|
s.summary = %q{Allow controller actions to force SSL on specific parts of the site.}
|
37
37
|
s.test_files = [
|
38
38
|
"test/ssl_requirement_test.rb",
|
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
|
|
43
43
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
44
44
|
s.specification_version = 3
|
45
45
|
|
46
|
-
if Gem::Version.new(Gem::
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
47
|
else
|
48
48
|
end
|
49
49
|
else
|
data/lib/ssl_requirement.rb
CHANGED
@@ -21,7 +21,7 @@ require "#{File.dirname(__FILE__)}/url_for"
|
|
21
21
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
23
|
module SslRequirement
|
24
|
-
mattr_writer :ssl_host, :non_ssl_host, :disable_ssl_check
|
24
|
+
mattr_writer :ssl_host, :non_ssl_host, :disable_ssl_check, :redirect_status
|
25
25
|
|
26
26
|
def self.ssl_host
|
27
27
|
determine_host(@@ssl_host) rescue nil
|
@@ -96,13 +96,13 @@ module SslRequirement
|
|
96
96
|
return true if SslRequirement.disable_ssl_check?
|
97
97
|
|
98
98
|
if ssl_required? && !request.ssl?
|
99
|
-
redirect_to determine_redirect_url(request, true)
|
99
|
+
redirect_to determine_redirect_url(request, true), :status => (redirect_status || :found)
|
100
100
|
flash.keep
|
101
101
|
return false
|
102
102
|
elsif request.ssl? && ssl_allowed?
|
103
103
|
return true
|
104
104
|
elsif request.ssl? && !ssl_required?
|
105
|
-
redirect_to determine_redirect_url(request, false)
|
105
|
+
redirect_to determine_redirect_url(request, false), :status => (redirect_status || :found)
|
106
106
|
flash.keep
|
107
107
|
return false
|
108
108
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bartt-ssl_requirement
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 1
|
7
8
|
- 2
|
8
|
-
-
|
9
|
-
version: 1.2.
|
9
|
+
- 6
|
10
|
+
version: 1.2.6
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- RailsJedi
|
@@ -22,7 +23,7 @@ autorequire:
|
|
22
23
|
bindir: bin
|
23
24
|
cert_chain: []
|
24
25
|
|
25
|
-
date: 2011-
|
26
|
+
date: 2011-05-26 00:00:00 -07:00
|
26
27
|
default_executable:
|
27
28
|
dependencies: []
|
28
29
|
|
@@ -57,23 +58,27 @@ rdoc_options:
|
|
57
58
|
require_paths:
|
58
59
|
- lib
|
59
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
60
62
|
requirements:
|
61
63
|
- - ">="
|
62
64
|
- !ruby/object:Gem::Version
|
65
|
+
hash: 3
|
63
66
|
segments:
|
64
67
|
- 0
|
65
68
|
version: "0"
|
66
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
67
71
|
requirements:
|
68
72
|
- - ">="
|
69
73
|
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
70
75
|
segments:
|
71
76
|
- 0
|
72
77
|
version: "0"
|
73
78
|
requirements: []
|
74
79
|
|
75
80
|
rubyforge_project:
|
76
|
-
rubygems_version: 1.3.
|
81
|
+
rubygems_version: 1.3.7
|
77
82
|
signing_key:
|
78
83
|
specification_version: 3
|
79
84
|
summary: Allow controller actions to force SSL on specific parts of the site.
|