shibkit-meta_meta 0.2.2

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.
Files changed (83) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +21 -0
  4. data/Gemfile.lock +52 -0
  5. data/Icon.png +0 -0
  6. data/LICENSE.txt +177 -0
  7. data/README.md +789 -0
  8. data/Rakefile +38 -0
  9. data/VERSION +1 -0
  10. data/examples/biggest_entity_id.rb +4 -0
  11. data/lib/shibkit/meta_meta.rb +600 -0
  12. data/lib/shibkit/meta_meta/attribute.rb +73 -0
  13. data/lib/shibkit/meta_meta/config.rb +463 -0
  14. data/lib/shibkit/meta_meta/contact.rb +85 -0
  15. data/lib/shibkit/meta_meta/data/default_metadata/example_federation_metadata.xml +168 -0
  16. data/lib/shibkit/meta_meta/data/default_metadata/local_metadata.xml +66 -0
  17. data/lib/shibkit/meta_meta/data/default_metadata/uncommon_federation_metadata.xml +115 -0
  18. data/lib/shibkit/meta_meta/data/default_metadata_cache.yml +166 -0
  19. data/lib/shibkit/meta_meta/data/dev_sources.yml +86 -0
  20. data/lib/shibkit/meta_meta/data/real_sources.yml +163 -0
  21. data/lib/shibkit/meta_meta/entity.rb +219 -0
  22. data/lib/shibkit/meta_meta/federation.rb +161 -0
  23. data/lib/shibkit/meta_meta/idp.rb +81 -0
  24. data/lib/shibkit/meta_meta/logo.rb +216 -0
  25. data/lib/shibkit/meta_meta/metadata_item.rb +244 -0
  26. data/lib/shibkit/meta_meta/mixin/cached_downloads.rb +127 -0
  27. data/lib/shibkit/meta_meta/mixin/xpath_chores.rb +111 -0
  28. data/lib/shibkit/meta_meta/organisation.rb +73 -0
  29. data/lib/shibkit/meta_meta/provider.rb +195 -0
  30. data/lib/shibkit/meta_meta/provisioning/base.rb +33 -0
  31. data/lib/shibkit/meta_meta/requested_attribute.rb +29 -0
  32. data/lib/shibkit/meta_meta/service.rb +94 -0
  33. data/lib/shibkit/meta_meta/source.rb +558 -0
  34. data/lib/shibkit/meta_meta/sp.rb +79 -0
  35. data/shibkit-meta_meta.gemspec +154 -0
  36. data/spec/meta_meta/attribute/token +0 -0
  37. data/spec/meta_meta/config/autoloading_and_refreshing_spec.rb +72 -0
  38. data/spec/meta_meta/config/code_nspec.rb +13 -0
  39. data/spec/meta_meta/config/configuration_spec.rb +30 -0
  40. data/spec/meta_meta/config/creation_spec.rb +43 -0
  41. data/spec/meta_meta/config/downloading_and_caching_settings_spec.rb +216 -0
  42. data/spec/meta_meta/config/env_platform_settings.rb +129 -0
  43. data/spec/meta_meta/config/filtering_settings_spec.rb +123 -0
  44. data/spec/meta_meta/config/init.rb +8 -0
  45. data/spec/meta_meta/config/logger_settings_spec.rb +91 -0
  46. data/spec/meta_meta/config/smartcache_settings_spec.rb +110 -0
  47. data/spec/meta_meta/config/source_file_settings_spec.rb +99 -0
  48. data/spec/meta_meta/config/tagging_settings_spec.rb +81 -0
  49. data/spec/meta_meta/config/working_directory_settings_spec.rb +106 -0
  50. data/spec/meta_meta/config/xml_processing_settings_spec.rb +75 -0
  51. data/spec/meta_meta/contact/contact_oldspec.rb +0 -0
  52. data/spec/meta_meta/entity/entity_oldspec.rb +53 -0
  53. data/spec/meta_meta/federation/federation_oldspec.rb +0 -0
  54. data/spec/meta_meta/idp/token +0 -0
  55. data/spec/meta_meta/logo/token +0 -0
  56. data/spec/meta_meta/meta_meta/cache_example.yaml +141284 -0
  57. data/spec/meta_meta/meta_meta/meta_meta_spec.rb +269 -0
  58. data/spec/meta_meta/meta_meta/saved_sources.yaml +46 -0
  59. data/spec/meta_meta/metadata_item/token +0 -0
  60. data/spec/meta_meta/organisation/organisation_oldspec.rb +0 -0
  61. data/spec/meta_meta/provider/token +0 -0
  62. data/spec/meta_meta/requested_attribute/token +0 -0
  63. data/spec/meta_meta/service/token +0 -0
  64. data/spec/meta_meta/source/application_extras_spec.rb +234 -0
  65. data/spec/meta_meta/source/conversion_spec.rb +75 -0
  66. data/spec/meta_meta/source/creation_spec.rb +0 -0
  67. data/spec/meta_meta/source/downloads_and_caching_spec.rb +0 -0
  68. data/spec/meta_meta/source/federation_information_spec.rb +11 -0
  69. data/spec/meta_meta/source/fixtures.rb +24 -0
  70. data/spec/meta_meta/source/init.rb +1 -0
  71. data/spec/meta_meta/source/loading_and_saving_spec.rb +0 -0
  72. data/spec/meta_meta/source/metadata_details_spec.rb +0 -0
  73. data/spec/meta_meta/source/metadata_integrity_spec.rb +0 -0
  74. data/spec/meta_meta/source/selection_spec.rb +0 -0
  75. data/spec/meta_meta/source/source_oldspec.rb +353 -0
  76. data/spec/meta_meta/source/xml_parsing_spec.rb +0 -0
  77. data/spec/meta_meta/sp/token +0 -0
  78. data/spec/meta_meta/template +2 -0
  79. data/spec/moi/config_spec.rb +0 -0
  80. data/spec/spec.opts +1 -0
  81. data/spec/spec_helper.rb +25 -0
  82. data/spec/support/supply_xml.rb +0 -0
  83. metadata +320 -0
@@ -0,0 +1,86 @@
1
+ ##
2
+ ## Federation Metdata Metadata: Development/test data
3
+ ##
4
+ ## * ______________________________________________________________________ *
5
+ ## * Important: Please Read This Disclaimer Right Now Before It Is Too Late *
6
+ ## * ______________________________________________________________________ *
7
+ ##
8
+ ## The information in this list is provided for convenience during development.
9
+ ## It is not, and *cannot*, be guaranteed to be accurate or up-to-date.
10
+ ## Do not rely on this information as-is for production services.
11
+ ##
12
+ ## Some processes should not always be automated.
13
+ ##
14
+ ## The correct way to validate metadata is to download the federation certificate
15
+ ## and verify it 'out of band', by telephone, signed email, or even by post.
16
+ ## DNS and even federation sites can be compromised or intercepted; if you
17
+ ## can't trust the certificate you can't trust the metadata.
18
+ ##
19
+
20
+ ## This file contains metadata about federation metadata and simpler collections
21
+ ## of metadata. It can be used to quickly populate your software with data on
22
+ ## SAML SPs and IDPs, run tests, or whatever else takes your fancy.
23
+
24
+ ## Please feel free to fork this project on Github, add new federation info,
25
+ ## then send a pull request!
26
+
27
+ ## UK Example Federation For Software Development
28
+ example:
29
+ name: UK Example Federation For Software Development
30
+ display_name: UK Example Federation
31
+ type: federation
32
+ countries: [gb]
33
+ metadata: example_federation_metadata.xml
34
+ certificate: ~
35
+ fingerprint: ~
36
+ refeds_info: ~
37
+ homepage: http://examplefederation.org.uk
38
+ languages: ['en-gb', en]
39
+ support_email: service@examplefederation.org.uk
40
+ description: >
41
+ An example federation with a few entities, mostly for software testing
42
+ purposes and idle amusement. Uttlerly rushed and bodged at present and not
43
+ actually valid, partially defeating the purpose of the exercise.
44
+ trustiness: 1
45
+ groups:
46
+ - fictional
47
+ tags:
48
+ - example
49
+
50
+
51
+ ## unCommon Federation
52
+ uncommon:
53
+ name: unCommon Federation
54
+ display_name: unCommon
55
+ type: federation
56
+ countries: [us]
57
+ metadata: uncommon_federation_metadata.xml
58
+ certificate: ~
59
+ fingerprint: ~
60
+ refeds_info: ~
61
+ homepage: http://www.uncommonfederation.org
62
+ languages: [en]
63
+ support_email: admin@uncommonfederation.org
64
+ description: >
65
+ Providing a set of example entities based on unusual and fictional
66
+ academic organisations.
67
+
68
+ ## Local collection
69
+ local:
70
+ name: Other Organisations
71
+ display_name: Other Organisations
72
+ type: collection
73
+ countries: [us]
74
+ metadata: local_metadata.xml
75
+ certificate: ~
76
+ fingerprint: ~
77
+ refeds_info: ~
78
+ homepage: ~
79
+ languages: [en]
80
+ support_email: ~
81
+ description: >
82
+ Other organisations that are not members of a federation.
83
+
84
+ ## Want more?
85
+ ## Fork this project on Github, add new federation info and
86
+ ## then send a pull request!
@@ -0,0 +1,163 @@
1
+ ##
2
+ ## Federation Metdata Metadata: Real Federations
3
+ ##
4
+ ## * ______________________________________________________________________ *
5
+ ## * Important: Please Read This Disclaimer Right Now Before It Is Too Late *
6
+ ## * ______________________________________________________________________ *
7
+ ##
8
+ ## The information in this list is provided for convenience during development.
9
+ ## It is not, and *cannot*, be guaranteed to be accurate or up-to-date.
10
+ ## Do not rely on this information as-is for production services.
11
+ ##
12
+ ## Some processes should not always be automated.
13
+ ##
14
+ ## The correct way to validate metadata is to download the federation certificate
15
+ ## and verify it 'out of band', by telephone, signed email, or even by post.
16
+ ## DNS and even federation sites can be compromised or intercepted; if you
17
+ ## can't trust the certificate you can't trust the metadata.
18
+ ##
19
+
20
+ ## This file contains metadata about federation metadata and simpler collections
21
+ ## of metadata. It can be used to quickly populate your software with data on
22
+ ## SAML SPs and IDPs, run tests, or whatever else takes your fancy.
23
+
24
+ ## Please feel free to fork this project on Github, add new federation info,
25
+ ## then send a pull request!
26
+
27
+ ## UK Access Management Federation For Education And Research
28
+ 'http://ukfederation.org.uk':
29
+ name: UK Access Management Federation For Education And Research
30
+ display_name: UK Access Management Federation
31
+ type: federation
32
+ countries: [:gb]
33
+ metadata: http://metadata.ukfederation.org.uk/ukfederation-metadata.xml
34
+ certificate: http://metadata.ukfederation.org.uk/ukfederation.pem
35
+ fingerprint: ~
36
+ refeds_info: https://refeds.terena.org/index.php/FederationUkfed
37
+ homepage: http://www.ukfederation.org.uk
38
+ languages: ['en-gb', :en]
39
+ support_email: service@ukfederation.org.uk
40
+ tags:
41
+ - :refeds
42
+ groups:
43
+ - :spec_set_1
44
+ - :spec_set_2
45
+ description: >
46
+ A single solution for accessing online resources and services for
47
+ education and research in the UK.
48
+
49
+ ## inCommon Federation
50
+ 'urn:mace:incommon':
51
+ name: inCommon Federation
52
+ display_name: inCommon
53
+ type: federation
54
+ countries: [:us]
55
+ metadata: https://wayf.incommonfederation.org/InCommon/InCommon-metadata.xml
56
+ certificate: https://wayf.incommonfederation.org/bridge/certs/incommon.pem
57
+ fingerprint: ~
58
+ refeds_info: https://refeds.terena.org/index.php/FederationIncommon
59
+ homepage: http://www.incommon.org
60
+ languages: ['en-us', 'en']
61
+ support_email: incommon-admin@incommonfederation.org
62
+ tags:
63
+ - refeds
64
+ - :test_tag1
65
+ groups:
66
+ - spec_set_2
67
+ description: >
68
+ Providing a secure and privacy-preserving trust fabric for research and
69
+ higher education institutions, and their partners, in the United States.
70
+
71
+ ## Australian Access Federation
72
+ 'urn:mace:aaf.edu.au:AAFProduction':
73
+ name: Australian Access Federation
74
+ display_name: AAF
75
+ type: federation
76
+ countries: ['au']
77
+ metadata: http://manager.aaf.edu.au/metadata/metadata.aaf.signed.complete.xml
78
+ certificate: https://manager.aaf.edu.au/metadata/metadata-cert.pem
79
+ fingerprint: ~
80
+ refeds_info: https://refeds.terena.org/index.php/FederationAAF
81
+ homepage: http://www.aaf.edu.au/
82
+ languages: ['en']
83
+ support_email: enquiries@aaf.edu.au
84
+ tags:
85
+ - refeds
86
+ groups:
87
+ - spec_set_2
88
+ description: >
89
+ The Australian Access Federation.
90
+
91
+ ## Canadian Access Federation
92
+ 'https://caf-fcga.ca/entity':
93
+ name: Canadian Access Federation
94
+ display_name: CAF
95
+ type: federation
96
+ countries: ['ca']
97
+ metadata: https://caf-shibops.ca/CoreServices/cafshib_metadata_signed.xml
98
+ certificate: https://caf-shibops.ca/CoreServices/cafshib_metadata_verify.pem
99
+ fingerprint: ~
100
+ refeds_info:
101
+ homepage: http://www.cuccio-cdpiuc.ca/en/index.php
102
+ languages: ['en']
103
+ support_email: ~
104
+ tags:
105
+ - refeds
106
+ groups:
107
+ - spec_set_2
108
+ description: >
109
+ Canadian Access Federation
110
+
111
+ ## Partial sources disabled with comment # until complete
112
+
113
+ ## Swiss Access Federation
114
+ #'urn:mace:switch.ch:SWITCHaai':
115
+ # name: Swiss Access Federation
116
+ # display_name: SWITCHaai
117
+ # type: federation
118
+ # countries: ['ch']
119
+ # metadata: http://www.switch.ch/aai/support/metadata/
120
+ # certificate: ~
121
+ # fingerprint: ~
122
+ # refeds_info: ~
123
+ # homepage: ~
124
+ # languages: []
125
+ # support_email: aai@switch.ch
126
+ # description: >
127
+ # Swiss Access Federation
128
+
129
+ ## FederationCARSI
130
+ # name:
131
+ # display_name:
132
+ # type:
133
+ # countries: []
134
+ # metadata: ~
135
+ # certificate:
136
+ # fingerprint: ~
137
+ # refeds_info: ~
138
+ # homepage: ~
139
+ # languages: ~
140
+ # support_email:
141
+ # description: >
142
+ # No information listed
143
+
144
+ ## FederationEdulDcz
145
+ # name:
146
+ # display_name:
147
+ # type:
148
+ # countries: []
149
+ # metadata: ~
150
+ # certificate: ~
151
+ # fingerprint: ~
152
+ # refeds_info: ~
153
+ # homepage: ~
154
+ # languages: ~
155
+ # support_email: Linden.mikael@rediris.es
156
+ # description: >
157
+ # No information listed
158
+
159
+
160
+
161
+ ## Want more?
162
+ ## Fork this project on Github, add new federation info and
163
+ ## then send a pull request!
@@ -0,0 +1,219 @@
1
+ ## @author Pete Birkinshaw (<pete@digitalidentitylabs.com>)
2
+ ## Copyright: Copyright (c) 2011 Digital Identity Ltd.
3
+ ## License: Apache License, Version 2.0
4
+
5
+ ## Licensed under the Apache License, Version 2.0 (the "License");
6
+ ## you may not use this file except in compliance with the License.
7
+ ## You may obtain a copy of the License at
8
+ ##
9
+ ## http://www.apache.org/licenses/LICENSE-2.0
10
+ ##
11
+ ## Unless required by applicable law or agreed to in writing, software
12
+ ## distributed under the License is distributed on an "AS IS" BASIS,
13
+ ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ ## See the License for the specific language governing permissions and
15
+ ## limitations under the License.
16
+ ##
17
+
18
+ module Shibkit
19
+ class MetaMeta
20
+
21
+ ## Class to represent the metadata of a Shibboleth IDP or SP
22
+ class Entity < MetadataItem
23
+
24
+ require 'shibkit/meta_meta/metadata_item'
25
+ require 'shibkit/meta_meta/contact'
26
+ require 'shibkit/meta_meta/idp'
27
+ require 'shibkit/meta_meta/sp'
28
+ require 'shibkit/meta_meta/organisation'
29
+
30
+ ## Element and attribute used to select XML for new objects
31
+ ROOT_ELEMENT = 'EntityDescriptor'
32
+ TARGET_ATTR = 'entityID'
33
+ REQUIRED_QUACKS = [:entity_uri]
34
+
35
+ LINE_START = "<!--"
36
+ LINE_END = "-->"
37
+ HR_CHAR = "="
38
+
39
+ ## The URI of the entity
40
+ attr_accessor :entity_uri
41
+ alias :uri :entity_uri
42
+
43
+ ## The URI of the entity's parent federation
44
+ attr_accessor :primary_federation_uri
45
+
46
+ ## The URI of the entity's parent federation
47
+ attr_accessor :other_federation_uris
48
+ alias :secondary_federation_uris :other_federation_uris
49
+
50
+ ## Has this entity object been selected to represent the service?
51
+ attr_accessor :primary
52
+
53
+ ## The ID of the entity with the metadata file (not globally unique)
54
+ attr_accessor :metadata_id
55
+
56
+ ## Is the entity accountable?
57
+ attr_accessor :accountable
58
+
59
+ ## Is the entity part of the UK Access Management Federation?
60
+ attr_accessor :ukfm
61
+
62
+ ## Is the entity using Athens?
63
+ attr_accessor :athens
64
+
65
+ ## Show in normal WAYFs?
66
+ attr_accessor :hide
67
+
68
+ attr_accessor :scopes
69
+
70
+ ## Organisation object for the owner of the entity
71
+ attr_accessor :organisation
72
+
73
+ ## Contact object containing user support contact details
74
+ attr_accessor :support_contact
75
+
76
+ ## Contact object containing technical contact details
77
+ attr_accessor :technical_contact
78
+
79
+ ## Contact object containing technical contact details
80
+ attr_accessor :admin_contact
81
+
82
+ ## Is the entity an IDP?
83
+ attr_accessor :idp
84
+
85
+ ## Is the entity an SP?
86
+ attr_accessor :sp
87
+
88
+ alias :entity_id :entity_uri
89
+ alias :ukfm? :ukfm
90
+ alias :hide? :hide
91
+ alias :accountable? :accountable
92
+ alias :athens? :athens
93
+ alias :organization :organisation
94
+
95
+ def to_s
96
+
97
+ return uri
98
+
99
+ end
100
+
101
+ def idp?
102
+
103
+ return idp.kind_of?(::Shibkit::MetaMeta::IDP)
104
+
105
+ end
106
+
107
+ def sp?
108
+
109
+ return sp.kind_of?(::Shibkit::MetaMeta::SP)
110
+
111
+ end
112
+
113
+ def urn?
114
+
115
+ return uri.strip.downcase[0..3] == 'urn:'
116
+
117
+ end
118
+
119
+ ##
120
+ def primary?
121
+
122
+ return @primary ? true : false
123
+
124
+ end
125
+
126
+ def multi_federated?
127
+
128
+ return other_federation_uris.size > 0 ? true : false
129
+
130
+ end
131
+
132
+ ## All federations that this entity is a member of
133
+ def federation_uris
134
+
135
+ ## All unique federations, making sure we include primary
136
+ all_fed_uris = [primary_federation_uri].concat other_federation_uris
137
+
138
+ return all_fed_uris.uniq
139
+
140
+ end
141
+
142
+ def tags=(tags)
143
+
144
+ @tags ||= []
145
+
146
+ if Shibkit::MetaMeta.config.auto_tag?
147
+
148
+ @tags << :idp if idp?
149
+ @tags << :sp if sp?
150
+
151
+ end
152
+
153
+ @tags = @tags.concat([tags].flatten).uniq
154
+
155
+ end
156
+
157
+ def tags
158
+
159
+ return @tags.nil? ? [] : @tags.collect { |t| t.to_sym }
160
+
161
+ end
162
+
163
+ def xml_comment
164
+
165
+ out = "\n" + LINE_START + (HR_CHAR * 71) + LINE_END + "\n"
166
+ out << LINE_START + " " + uri + " " + LINE_END + "\n"
167
+ out << LINE_START + (HR_CHAR * 71) + LINE_END + "\n\n"
168
+
169
+ return out
170
+
171
+ end
172
+
173
+ private
174
+
175
+ def parse_xml
176
+
177
+ self.entity_uri = @noko['entityID'].to_s.strip
178
+ self.metadata_id = @noko['ID'].to_s.strip
179
+
180
+ @other_federation_uris ||= Array.new
181
+
182
+ ## Boolean flags for common/useful info
183
+ self.accountable = @noko.xpath('xmlns:Extensions/ukfedlabel:AccountableUsers').size > 0 ? true : false
184
+ self.ukfm = @noko.xpath('xmlns:Extensions/ukfedlabel:UKFederationMember').size > 0 ? true : false
185
+ self.athens = @noko.xpath('xmlns:Extensions/elab:AthensPUIDAuthority').size > 0 ? true : false
186
+ self.hide = @noko.xpath('xmlns:Extensions/wayf:HideFromWAYF').size > 0 ? true : false
187
+
188
+ @scopes = @noko.xpath('xmlns:Extensions/shibmd:Scope').collect do |sx|
189
+
190
+ sx['regexp'] == 'true' ? Regexp.new(sx.text) : sx.text
191
+
192
+ end
193
+
194
+ ## IDP and SP objects, if available. Based on the same XML as their parent/entity object
195
+ self.idp = Shibkit::MetaMeta::IDP.new(@noko).filter
196
+ self.sp = Shibkit::MetaMeta::SP.new(@noko).filter
197
+
198
+ ## Include Contact objects
199
+ self.support_contact = Contact.new(@noko.xpath("xmlns:ContactPerson[@contactType='support'][1]")[0]).filter
200
+ self.technical_contact = Contact.new(@noko.xpath("xmlns:ContactPerson[@contactType='technical'][1]")[0]).filter
201
+ self.admin_contact = Contact.new(@noko.xpath("xmlns:ContactPerson[@contactType='administrative'][1]")[0]).filter
202
+
203
+ ## Include an organisation object
204
+ self.organisation = Organisation.new(@noko.xpath("xmlns:Organization[1]")[0]).filter
205
+ self.idp.organisation = self.organisation if idp?
206
+ self.sp.organisation = self.organisation if sp?
207
+
208
+ self.tags ||= []
209
+
210
+ log.debug " Derived entity #{self.uri} from XML"
211
+
212
+ end
213
+
214
+ end
215
+
216
+
217
+ end
218
+ end
219
+