shibboleths_lil_helper 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/Gemfile +16 -0
  2. data/Gemfile.lock +36 -0
  3. data/LICENSE.txt +20 -0
  4. data/README.markdown +199 -0
  5. data/Rakefile +54 -0
  6. data/TODOS.txt +15 -0
  7. data/VERSION +1 -0
  8. data/bin/slh +9 -0
  9. data/doc/debugging_shibboleth.markdown +8 -0
  10. data/doc/deprecated_code_that_could_be_useful.rb +32 -0
  11. data/doc/for_slh_developers.markdown +38 -0
  12. data/doc/nuances.markdown +13 -0
  13. data/doc/technical_question_and_answer.markdown +85 -0
  14. data/lib/shibboleths_lil_helper.rb +9 -0
  15. data/lib/slh.rb +17 -0
  16. data/lib/slh/class_methods.rb +83 -0
  17. data/lib/slh/cli.rb +140 -0
  18. data/lib/slh/cli/command_base.rb +32 -0
  19. data/lib/slh/cli/compare_metadata.rb +53 -0
  20. data/lib/slh/cli/copy_templates_to_override.rb +12 -0
  21. data/lib/slh/cli/describe_config.rb +75 -0
  22. data/lib/slh/cli/fetch_metadata.rb +27 -0
  23. data/lib/slh/cli/generate.rb +20 -0
  24. data/lib/slh/cli/generate_capistrano_deploy.rb +35 -0
  25. data/lib/slh/cli/generate_metadata.rb +53 -0
  26. data/lib/slh/cli/host_filterable_base.rb +16 -0
  27. data/lib/slh/cli/initialize.rb +30 -0
  28. data/lib/slh/cli/verify_metadata_encryption.rb +25 -0
  29. data/lib/slh/models/base.rb +23 -0
  30. data/lib/slh/models/host.rb +55 -0
  31. data/lib/slh/models/site.rb +139 -0
  32. data/lib/slh/models/site_path.rb +17 -0
  33. data/lib/slh/models/strategy.rb +131 -0
  34. data/lib/slh/models/version.rb +4 -0
  35. data/lib/slh/templates/_application_details.erb +33 -0
  36. data/lib/slh/templates/config.rb.erb +33 -0
  37. data/lib/slh/templates/deploy.rb.erb +42 -0
  38. data/lib/slh/templates/shib_apache.conf.erb +24 -0
  39. data/lib/slh/templates/shibboleth2.xml.erb +44 -0
  40. data/lib/slh/templates/sp_metadata_for_entity_id_to_give_to_idp.xml.erb +40 -0
  41. data/lib/slh/templates/sp_metadata_for_host_to_give_to_idp.xml.erb +33 -0
  42. data/shibboleths_lil_helper.gemspec +111 -0
  43. data/test/fixtures/dummy1.rb +15 -0
  44. data/test/fixtures/dummy1_output/attribute-map.xml +5 -0
  45. data/test/fixtures/dummy1_output/shib_for_vhost.conf +15 -0
  46. data/test/fixtures/dummy1_output/shibboleth2.xml +27 -0
  47. data/test/helper.rb +18 -0
  48. data/test/test_shibboleths_lil_helper.rb +105 -0
  49. metadata +211 -0
@@ -0,0 +1,15 @@
1
+ # Slh.define_entity_id :default, 'https://shib-local-vm1.asr.umn.edu/rhel5_sp1'
2
+ # Slh.define_idp_meta_data :default, 'https://idp-test.shib.umn.edu/metadata.xml'
3
+ # Slh.define_error_support_contact :default, 'goggins@umn.edu'
4
+ #
5
+ Slh.define_strategy :dummy1,
6
+ :sp_entity_id => 'https://shib-local-vm1.asr.umn.edu/rhel5_sp1',
7
+ :idp_metadata_url => 'https://idp-test.shib.umn.edu/metadata.xml',
8
+ :error_support_contact => 'goggins@umn.edu' do
9
+ for_host 'shib-local-vm1.asr.umn.edu' do
10
+ for_app 'https://shib-local-vm1.asr.umn.edu' do
11
+ protect_location '/secure'
12
+ protect_location '/lazy', :with => :lazy_authentication
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ <Attributes xmlns="urn:mace:shibboleth:2.0:attribute-map" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2
+ <Attribute name="urn:oid:1.3.6.1.4.1.5923.1.1.1.6" id="eppn">
3
+ <AttributeDecoder xsi:type="ScopedAttributeDecoder"/>
4
+ </Attribute>
5
+ </Attributes>
@@ -0,0 +1,15 @@
1
+ # THIS SHOULD BE INCLUDED via an Apache Include statement or copy and
2
+ # pasted in your
3
+ # <VirtualHost AN_IP_ADD:80> and <VirtualHost AN_IP_ADDR:443> sections
4
+ <Location /secure>
5
+ AuthType shibboleth
6
+ ShibRequestSetting requireSession 1
7
+ ShibUseEnvironment On
8
+ require valid-user
9
+ </Location>
10
+
11
+ <Location /lazy>
12
+ AuthType shibboleth
13
+ require shibboleth
14
+ </Location>
15
+
@@ -0,0 +1,27 @@
1
+ <SPConfig xmlns="urn:mace:shibboleth:2.0:native:sp:config"
2
+ xmlns:conf="urn:mace:shibboleth:2.0:native:sp:config"
3
+ xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
4
+ xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol"
5
+ xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
6
+ clockSkew="180">
7
+ <ApplicationDefaults entityID="https://shib-local-vm1.asr.umn.edu/rhel5_sp1">
8
+ <Sessions lifetime="28800" timeout="3600" checkAddress="false" relayState="ss:mem" handlerSSL="false">
9
+ <SSO entityID="https://idp-test.shib.umn.edu/idp/shibboleth">
10
+ SAML2 SAML1
11
+ </SSO>
12
+ <Logout>SAML2 Local</Logout>
13
+ <Handler type="MetadataGenerator" Location="/Metadata" signing="false"/>
14
+ <Handler type="Status" Location="/Status" />
15
+ <Handler type="Session" Location="/Session" showAttributeValues="false"/>
16
+ <Handler type="DiscoveryFeed" Location="/DiscoFeed"/>
17
+ </Sessions>
18
+ <Errors supportContact="goggins@umn.edu" logoLocation="/shibboleth-sp/logo.jpg" styleSheet="/shibboleth-sp/main.css"/>
19
+ <MetadataProvider type="XML" file="idp_metadata.xml"/>
20
+ <AttributeExtractor type="XML" validate="true" path="attribute-map.xml"/>
21
+ <AttributeResolver type="Query" subjectMatch="true"/>
22
+ <AttributeFilter type="XML" validate="true" path="attribute-policy.xml"/>
23
+ <CredentialResolver type="File" key="sp-key.pem" certificate="sp-cert.pem"/>
24
+ </ApplicationDefaults>
25
+ <SecurityPolicyProvider type="XML" validate="true" path="security-policy.xml"/>
26
+ <ProtocolProvider type="XML" validate="true" reloadChanges="false" path="protocols.xml"/>
27
+ </SPConfig>
data/test/helper.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'shibboleths_lil_helper'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,105 @@
1
+ require 'helper'
2
+
3
+ class TestShibbolethsLilHelper < Test::Unit::TestCase
4
+ # should "have a Slh namespace that will contain all classes contained" do
5
+ # assert Slh.class == Module
6
+ # end
7
+ # should "provides class representing core shibboleth model-ish ideas" do
8
+ # assert Slh::Models::App.class == Class
9
+ # assert Slh::Models::Host.class == Class
10
+ # # TODO add more
11
+ # end
12
+ # should "provide some top level methods for using the tool" do
13
+ # # TODO add more
14
+ # end
15
+
16
+ # context "with :dummy1 strategy" do
17
+ # setup do
18
+ # require 'fixtures/dummy1.rb'
19
+ # @strategy = Slh.with(:dummy1)
20
+ # end
21
+ # teardown do
22
+ # FileUtils.rm_rf(@strategy.config_dir)
23
+ # end
24
+ # should "have an entity id" do
25
+ # assert_equal "https://shib-local-vm1.asr.umn.edu/rhel5_sp1", @strategy.sp_entity_id
26
+ # assert_raises RuntimeError do
27
+ # Slh::Models::Strategy.new(:poo) # Must specify a :sp_entity_id and idp_entity_id
28
+ # end
29
+ # end
30
+ # should "have an idp_metadata_url" do
31
+ # assert_equal "https://idp-test.shib.umn.edu/metadata.xml", @strategy.idp_metadata_url
32
+ # end
33
+ # should "have an idp_entity_id extracted from the idp_metadata_url contents" do
34
+ # # WARNING: THIS CODE IS BRITTLE AND CODED AGAINST an XML format returned from https://idp-test.shib.umn.edu/metadata.xml
35
+ # assert_equal "https://idp-test.shib.umn.edu/idp/shibboleth", @strategy.idp_entity_id
36
+ # end
37
+ # should "have an error_support_contact" do
38
+ # assert_equal "goggins@umn.edu", @strategy.error_support_contact
39
+ # end
40
+ # should "load up a strategy" do
41
+ # assert_kind_of Slh::Models::Strategy, @strategy
42
+ # assert_raises RuntimeError do
43
+ # Slh.with(:asldfjlaksdjflk)
44
+ # end
45
+ # end
46
+ # should "have a non-empty hosts array" do
47
+ # assert_kind_of Array, @strategy.hosts
48
+ # assert @strategy.hosts.length > 0, 'more than 1 host in the array'
49
+ # assert @strategy.hosts.first.name == 'shib-local-vm1.asr.umn.edu'
50
+ # end
51
+ # should "have a non-empty apps array for the first host" do
52
+ # assert_kind_of Array, @strategy.hosts.first.apps
53
+ # assert @strategy.hosts.first.apps.length > 0
54
+ # assert @strategy.hosts.first.apps.first.url == 'https://shib-local-vm1.asr.umn.edu'
55
+ # end
56
+ # should "have non-empty app_auth_rules array for first host and first app" do
57
+ # assert_kind_of Array, @strategy.hosts.first.apps.first.auth_rules
58
+
59
+ # # First auth rule
60
+ # assert @strategy.hosts.first.apps.first.auth_rules.first.url_path == '/secure'
61
+ # assert @strategy.hosts.first.apps.first.auth_rules.first.rule_type == :location
62
+ # assert @strategy.hosts.first.apps.first.auth_rules.first.flavor == :mandatory_authentication
63
+
64
+ # # Second auth rule
65
+ # assert @strategy.hosts.first.apps.first.auth_rules[1].url_path == '/lazy'
66
+ # assert @strategy.hosts.first.apps.first.auth_rules[1].rule_type == :location
67
+ # assert @strategy.hosts.first.apps.first.auth_rules[1].flavor == :lazy_authentication
68
+ # end
69
+
70
+ # should "generate a config dir" do
71
+ # @strategy.generate_config
72
+ # assert File.directory?(@strategy.config_dir)
73
+ # end
74
+
75
+ # should "generate a shibboleth2.xml" do
76
+ # @strategy.generate_config
77
+ # assert File.exists?(@strategy.config_file_path('shibboleth2.xml'))
78
+ # expected_content = File.read(File.join(File.dirname(__FILE__),'fixtures','dummy1_output/shibboleth2.xml'))
79
+ # actual_content = File.read(@strategy.config_file_path('shibboleth2.xml'))
80
+ # assert_equal expected_content, actual_content
81
+ # end
82
+
83
+ # should "write the idp_metadata gathered from the idp_metadata_url to a file" do
84
+ # @strategy.generate_config
85
+ # assert File.exists?(@strategy.config_file_path('idp_metadata.xml'))
86
+ # assert_equal @strategy.idp_metadata, File.read(@strategy.config_file_path('idp_metadata.xml'))
87
+ # end
88
+
89
+ # should "generate the attribute-map.xml" do
90
+ # @strategy.generate_config
91
+ # assert File.exists?(@strategy.config_file_path('attribute-map.xml'))
92
+ # expected_content = File.read(File.join(File.dirname(__FILE__),'fixtures','dummy1_output/attribute-map.xml'))
93
+ # actual_content = File.read(@strategy.config_file_path('attribute-map.xml'))
94
+ # assert_equal expected_content, actual_content
95
+ # end
96
+
97
+ # should "generate shib_for_vhost.conf for each host and app" do
98
+ # @strategy.generate_config
99
+ # assert File.exists?(@strategy.config_file_path('shib_for_vhost.conf'))
100
+ # expected_content = File.read(File.join(File.dirname(__FILE__),'fixtures','dummy1_output/shib_for_vhost.conf'))
101
+ # actual_content = File.read(@strategy.config_file_path('shib_for_vhost.conf'))
102
+ # assert_equal expected_content, actual_content
103
+ # end
104
+ # end
105
+ end
metadata ADDED
@@ -0,0 +1,211 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: shibboleths_lil_helper
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ - 0
9
+ version: 1.0.0
10
+ platform: ruby
11
+ authors:
12
+ - Joe Goggins
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-11-01 00:00:00 -05:00
18
+ default_executable: slh
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ type: :runtime
22
+ name: activesupport
23
+ version_requirements: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 3
29
+ - 0
30
+ - 9
31
+ version: 3.0.9
32
+ requirement: *id001
33
+ prerelease: false
34
+ - !ruby/object:Gem::Dependency
35
+ type: :runtime
36
+ name: nokogiri
37
+ version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ requirement: *id002
45
+ prerelease: false
46
+ - !ruby/object:Gem::Dependency
47
+ type: :runtime
48
+ name: i18n
49
+ version_requirements: &id003 !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ segments:
54
+ - 0
55
+ version: "0"
56
+ requirement: *id003
57
+ prerelease: false
58
+ - !ruby/object:Gem::Dependency
59
+ type: :development
60
+ name: shoulda
61
+ version_requirements: &id004 !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ requirement: *id004
69
+ prerelease: false
70
+ - !ruby/object:Gem::Dependency
71
+ type: :development
72
+ name: bundler
73
+ version_requirements: &id005 !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ segments:
78
+ - 1
79
+ - 0
80
+ - 0
81
+ version: 1.0.0
82
+ requirement: *id005
83
+ prerelease: false
84
+ - !ruby/object:Gem::Dependency
85
+ type: :development
86
+ name: jeweler
87
+ version_requirements: &id006 !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ~>
90
+ - !ruby/object:Gem::Version
91
+ segments:
92
+ - 1
93
+ - 6
94
+ - 4
95
+ version: 1.6.4
96
+ requirement: *id006
97
+ prerelease: false
98
+ - !ruby/object:Gem::Dependency
99
+ type: :development
100
+ name: rcov
101
+ version_requirements: &id007 !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ segments:
106
+ - 0
107
+ version: "0"
108
+ requirement: *id007
109
+ prerelease: false
110
+ - !ruby/object:Gem::Dependency
111
+ type: :development
112
+ name: ruby-debug
113
+ version_requirements: &id008 !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ segments:
118
+ - 0
119
+ version: "0"
120
+ requirement: *id008
121
+ prerelease: false
122
+ description: See the summary text.
123
+ email: goggins@umn.edu
124
+ executables:
125
+ - slh
126
+ extensions: []
127
+
128
+ extra_rdoc_files:
129
+ - LICENSE.txt
130
+ - README.markdown
131
+ files:
132
+ - Gemfile
133
+ - Gemfile.lock
134
+ - LICENSE.txt
135
+ - README.markdown
136
+ - Rakefile
137
+ - TODOS.txt
138
+ - VERSION
139
+ - bin/slh
140
+ - doc/debugging_shibboleth.markdown
141
+ - doc/deprecated_code_that_could_be_useful.rb
142
+ - doc/for_slh_developers.markdown
143
+ - doc/nuances.markdown
144
+ - doc/technical_question_and_answer.markdown
145
+ - lib/shibboleths_lil_helper.rb
146
+ - lib/slh.rb
147
+ - lib/slh/class_methods.rb
148
+ - lib/slh/cli.rb
149
+ - lib/slh/cli/command_base.rb
150
+ - lib/slh/cli/compare_metadata.rb
151
+ - lib/slh/cli/copy_templates_to_override.rb
152
+ - lib/slh/cli/describe_config.rb
153
+ - lib/slh/cli/fetch_metadata.rb
154
+ - lib/slh/cli/generate.rb
155
+ - lib/slh/cli/generate_capistrano_deploy.rb
156
+ - lib/slh/cli/generate_metadata.rb
157
+ - lib/slh/cli/host_filterable_base.rb
158
+ - lib/slh/cli/initialize.rb
159
+ - lib/slh/cli/verify_metadata_encryption.rb
160
+ - lib/slh/models/base.rb
161
+ - lib/slh/models/host.rb
162
+ - lib/slh/models/site.rb
163
+ - lib/slh/models/site_path.rb
164
+ - lib/slh/models/strategy.rb
165
+ - lib/slh/models/version.rb
166
+ - lib/slh/templates/_application_details.erb
167
+ - lib/slh/templates/config.rb.erb
168
+ - lib/slh/templates/deploy.rb.erb
169
+ - lib/slh/templates/shib_apache.conf.erb
170
+ - lib/slh/templates/shibboleth2.xml.erb
171
+ - lib/slh/templates/sp_metadata_for_entity_id_to_give_to_idp.xml.erb
172
+ - lib/slh/templates/sp_metadata_for_host_to_give_to_idp.xml.erb
173
+ - shibboleths_lil_helper.gemspec
174
+ - test/fixtures/dummy1.rb
175
+ - test/fixtures/dummy1_output/attribute-map.xml
176
+ - test/fixtures/dummy1_output/shib_for_vhost.conf
177
+ - test/fixtures/dummy1_output/shibboleth2.xml
178
+ - test/helper.rb
179
+ - test/test_shibboleths_lil_helper.rb
180
+ has_rdoc: true
181
+ homepage: http://github.com/joegoggins/shibboleths_lil_helper
182
+ licenses:
183
+ - MIT
184
+ post_install_message:
185
+ rdoc_options: []
186
+
187
+ require_paths:
188
+ - lib
189
+ required_ruby_version: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - ">="
192
+ - !ruby/object:Gem::Version
193
+ segments:
194
+ - 0
195
+ version: "0"
196
+ required_rubygems_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ segments:
201
+ - 0
202
+ version: "0"
203
+ requirements: []
204
+
205
+ rubyforge_project:
206
+ rubygems_version: 1.3.6
207
+ signing_key:
208
+ specification_version: 3
209
+ summary: A ruby gem to streamline the setup, deployment, and ongoing management of Apache & IIS web-servers running the Shibboleth Native Service Provider implementations.
210
+ test_files: []
211
+