p3p 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +26 -3
- data/lib/p3p.rb +15 -0
- data/lib/p3p/configuration.rb +10 -0
- data/lib/p3p/middleware.rb +1 -1
- data/lib/p3p/version.rb +1 -1
- data/p3p.gemspec +1 -1
- data/spec/configuration_spec.rb +36 -0
- data/spec/spec_helper.rb +1 -1
- metadata +27 -19
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8f550e7c69a702fdd9f7211a26bb779f7f963f98
|
4
|
+
data.tar.gz: 32e4d7edcb995e46e4aaa5381b796774a2cd11b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1cdb1129adcd321588ac740cf68d74cc8285a9c50ed3b2f1b326a54541fbe670011e07e287343b6d4239624c177189ef2d469109989813ab286a82198dd95ee2
|
7
|
+
data.tar.gz: 84b061736900c9c853082b31b3679b38099301e958e3de3c631d41917a4854ef1d043fa27969d8263ac61e92b876422186c106be2b2fe40ebb738a550caad461
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
#
|
1
|
+
# P3P
|
2
2
|
|
3
|
-
|
3
|
+
Inserts P3P headers to allow cookies to be utilized in iframe scenarios with IE.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -18,7 +18,27 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
### Configuration
|
22
|
+
You can customize the P3P header text, if you so desire.
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
P3P.configure do |config|
|
26
|
+
config.header = 'CP="CAO PSA OUR"'
|
27
|
+
end
|
28
|
+
|
29
|
+
# Default Header: 'CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"'
|
30
|
+
```
|
31
|
+
|
32
|
+
### Rails
|
33
|
+
|
34
|
+
Just add the gem into your Gemfile and bundle! That's it!
|
35
|
+
|
36
|
+
### Rack
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
require 'p3p'
|
40
|
+
use P3P::Middleware
|
41
|
+
```
|
22
42
|
|
23
43
|
## Contributing
|
24
44
|
|
@@ -27,3 +47,6 @@ TODO: Write usage instructions here
|
|
27
47
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
48
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
49
|
5. Create new Pull Request
|
50
|
+
|
51
|
+
|
52
|
+
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/carrot/p3p/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
|
data/lib/p3p.rb
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
require "p3p/configuration"
|
1
2
|
require "p3p/middleware"
|
2
3
|
require "p3p/version"
|
3
4
|
require "p3p/railtie" if defined?(Rails)
|
5
|
+
|
6
|
+
module P3P
|
7
|
+
class << self
|
8
|
+
attr_writer :configuration
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.configuration
|
12
|
+
@configuration ||= Configuration.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.configure
|
16
|
+
yield(configuration)
|
17
|
+
end
|
18
|
+
end
|
data/lib/p3p/middleware.rb
CHANGED
data/lib/p3p/version.rb
CHANGED
data/p3p.gemspec
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_examples "it returns the configured P3P header" do |http_verb|
|
4
|
+
let(:header) { P3P::Configuration::DEFAULT_HEADER }
|
5
|
+
|
6
|
+
it "should return P3P headers in a the case of a #{http_verb} request" do
|
7
|
+
headers = { 'Content-Type' => 'text/html' }
|
8
|
+
app = lambda { |env| [200, headers, []] }
|
9
|
+
request = Rack::MockRequest.env_for('/', lint: true, fatal: true, method: http_verb)
|
10
|
+
response = P3P::Middleware.new(app).call(request)
|
11
|
+
|
12
|
+
expect(response[1]).to include("P3P" => header)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe P3P do
|
17
|
+
describe "#configure" do
|
18
|
+
let(:header) { "This is not a real p3p header. Check out our privacy policy at example.com/privacy" }
|
19
|
+
|
20
|
+
before do
|
21
|
+
P3P.configure do |config|
|
22
|
+
config.header = header
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it_should_behave_like "it returns the configured P3P header", "GET"
|
27
|
+
it_should_behave_like "it returns the configured P3P header", "POST"
|
28
|
+
it_should_behave_like "it returns the configured P3P header", "PUT"
|
29
|
+
it_should_behave_like "it returns the configured P3P header", "DELETE"
|
30
|
+
it_should_behave_like "it returns the configured P3P header", "HEAD"
|
31
|
+
it_should_behave_like "it returns the configured P3P header", "OPTIONS"
|
32
|
+
it_should_behave_like "it returns the configured P3P header", "TRACE"
|
33
|
+
it_should_behave_like "it returns the configured P3P header", "CONNECT"
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,38 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: p3p
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tom Milewski
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-09-30 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rack
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: rspec
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- -
|
31
|
+
- - "~>"
|
31
32
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
33
|
+
version: 3.1.0
|
33
34
|
type: :development
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 3.1.0
|
36
41
|
description: Inserts P3P header
|
37
42
|
email:
|
38
43
|
- tmilewski@gmail.com
|
@@ -40,43 +45,46 @@ executables: []
|
|
40
45
|
extensions: []
|
41
46
|
extra_rdoc_files: []
|
42
47
|
files:
|
43
|
-
- .gitignore
|
48
|
+
- ".gitignore"
|
44
49
|
- Gemfile
|
45
50
|
- LICENSE.txt
|
46
51
|
- README.md
|
47
52
|
- Rakefile
|
48
53
|
- lib/p3p.rb
|
54
|
+
- lib/p3p/configuration.rb
|
49
55
|
- lib/p3p/middleware.rb
|
50
56
|
- lib/p3p/railtie.rb
|
51
57
|
- lib/p3p/version.rb
|
52
58
|
- p3p.gemspec
|
59
|
+
- spec/configuration_spec.rb
|
53
60
|
- spec/middleware_spec.rb
|
54
61
|
- spec/spec_helper.rb
|
55
62
|
homepage: https://github.com/tmilewski/p3p
|
56
63
|
licenses: []
|
64
|
+
metadata: {}
|
57
65
|
post_install_message:
|
58
66
|
rdoc_options: []
|
59
67
|
require_paths:
|
60
68
|
- lib
|
61
69
|
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
-
none: false
|
63
70
|
requirements:
|
64
|
-
- -
|
71
|
+
- - ">="
|
65
72
|
- !ruby/object:Gem::Version
|
66
73
|
version: '0'
|
67
74
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
75
|
requirements:
|
70
|
-
- -
|
76
|
+
- - ">="
|
71
77
|
- !ruby/object:Gem::Version
|
72
78
|
version: '0'
|
73
79
|
requirements: []
|
74
80
|
rubyforge_project:
|
75
|
-
rubygems_version:
|
81
|
+
rubygems_version: 2.2.2
|
76
82
|
signing_key:
|
77
|
-
specification_version:
|
83
|
+
specification_version: 4
|
78
84
|
summary: Inserts P3P headers to allow cookies to be utilized in iframe scenarios with
|
79
85
|
IE.
|
80
86
|
test_files:
|
87
|
+
- spec/configuration_spec.rb
|
81
88
|
- spec/middleware_spec.rb
|
82
89
|
- spec/spec_helper.rb
|
90
|
+
has_rdoc:
|