scashin133-rsaml 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -13,6 +13,37 @@ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
13
13
  PKG_DESTINATION = ENV["PKG_DESTINATION"] || "../#{PKG_NAME}"
14
14
 
15
15
  RELEASE_NAME = "REL #{PKG_VERSION}"
16
+ PKG_FILES = FileList[
17
+ #'CHANGELOG',
18
+ #'LICENSE',
19
+ 'README',
20
+ #'TODO',
21
+ 'Rakefile',
22
+ 'bin/**/*',
23
+ 'doc/**/*',
24
+ 'lib/**/*',
25
+ ] - [ 'test' ]
26
+
27
+ spec = Gem::Specification.new do |s|
28
+ s.name = 'rsaml'
29
+ s.version = PKG_VERSION
30
+ s.summary = "RSAML - SAML implementation in Ruby."
31
+ s.description = <<-EOF
32
+ An implementation of SAML in Ruby.
33
+ EOF
34
+
35
+ s.add_dependency('rake', '>= 0.7.1')
36
+ s.add_dependency('uuid', '>= 1.0.4')
37
+
38
+ s.rdoc_options << '--exclude' << '.'
39
+ s.has_rdoc = false
40
+
41
+ s.files = PKG_FILES.to_a.delete_if {|f| f.include?('.svn')}
42
+ s.require_path = 'lib'
43
+
44
+ s.author = "Anthony Eden"
45
+ s.email = "anthonyeden@gmail.com"
46
+ end
16
47
 
17
48
  begin
18
49
  require 'jeweler'
@@ -30,6 +61,8 @@ begin
30
61
  gemspec.add_dependency('activesupport', '>=2.3.4')
31
62
  gemspec.add_dependency('uuid', '>=2.1.1')
32
63
  gemspec.version = PKG_VERSION
64
+ gemspec.files = PKG_FILES.to_a.delete_if {|f| f.include?('.svn')}
65
+ gemspec.require_path = 'lib'
33
66
  end
34
67
  Jeweler::GemcutterTasks.new
35
68
  rescue LoadError
@@ -68,44 +101,6 @@ namespace :rcov do
68
101
  end
69
102
  end
70
103
 
71
- PKG_FILES = FileList[
72
- #'CHANGELOG',
73
- #'LICENSE',
74
- 'README',
75
- #'TODO',
76
- 'Rakefile',
77
- 'bin/**/*',
78
- 'doc/**/*',
79
- 'lib/**/*',
80
- ] - [ 'test' ]
81
-
82
- spec = Gem::Specification.new do |s|
83
- s.name = 'rsaml'
84
- s.version = PKG_VERSION
85
- s.summary = "RSAML - SAML implementation in Ruby."
86
- s.description = <<-EOF
87
- An implementation of SAML in Ruby.
88
- EOF
89
-
90
- s.add_dependency('rake', '>= 0.7.1')
91
- s.add_dependency('uuid', '>= 1.0.4')
92
-
93
- s.rdoc_options << '--exclude' << '.'
94
- s.has_rdoc = false
95
-
96
- s.files = PKG_FILES.to_a.delete_if {|f| f.include?('.svn')}
97
- s.require_path = 'lib'
98
-
99
- s.author = "Anthony Eden"
100
- s.email = "anthonyeden@gmail.com"
101
- end
102
-
103
- Rake::GemPackageTask.new(spec) do |pkg|
104
- pkg.gem_spec = spec
105
- pkg.need_tar = true
106
- pkg.need_zip = true
107
- end
108
-
109
104
  desc "Generate code statistics"
110
105
  task :lines do
111
106
  lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
@@ -103,7 +103,7 @@ module RSAML #:nodoc:
103
103
  def initialize(issuer)
104
104
  @issuer = issuer
105
105
  @version = "2.0"
106
- @id = UUID.new
106
+ @id = UUID.new.generate
107
107
  @issue_instant = Time.now.utc
108
108
  end
109
109
 
@@ -34,7 +34,7 @@ module RSAML #:nodoc:
34
34
 
35
35
  # Initialize the message instance
36
36
  def initialize
37
- @id = UUID.new
37
+ @id = UUID.new.generate
38
38
  @version = "2.0"
39
39
  @issue_instant = Time.now.utc
40
40
  end
data/lib/rsaml/version.rb CHANGED
@@ -2,7 +2,7 @@ module RSAML#:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/lib/rsaml.rb CHANGED
@@ -15,7 +15,13 @@ end
15
15
 
16
16
  require 'rubygems'
17
17
  require 'uuid'
18
- require 'activesupport'
18
+ begin
19
+ require 'activesupport'
20
+ rescue LoadError
21
+ require 'active_support'
22
+ end
23
+
24
+ require "rexml/document"
19
25
 
20
26
  $:.unshift(File.dirname(__FILE__))
21
27
 
data/test/action_test.rb CHANGED
@@ -18,7 +18,7 @@ class ActionTest < Test::Unit::TestCase
18
18
  end
19
19
  context "when consuming xml" do
20
20
  should "return a valid Action instance" do
21
- action = Action.from_xml('<saml:Action>Read</saml:Action>')
21
+ action = Action.from_xml('<saml:Action xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">Read</saml:Action>')
22
22
  assert_not_nil(action)
23
23
  assert_equal 'Read', action.value
24
24
  assert_equal Action.namespaces[:rwedc_negation], action.namespace
@@ -26,7 +26,7 @@ class ActionTest < Test::Unit::TestCase
26
26
  end
27
27
  context "with an action namespace attribute" do
28
28
  should "return a valid Action instance with an action namespace" do
29
- action = Action.from_xml(%Q(<saml:Action Namespace="#{Action.namespaces[:rwedc]}">Write</saml:Action>))
29
+ action = Action.from_xml(%Q(<saml:Action xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Namespace="#{Action.namespaces[:rwedc]}">Write</saml:Action>))
30
30
  assert_not_nil(action)
31
31
  assert_equal 'Write', action.value
32
32
  assert_equal Action.namespaces[:rwedc], action.namespace
data/test/advice_test.rb CHANGED
@@ -16,7 +16,7 @@ class AdviceTest < Test::Unit::TestCase
16
16
  end
17
17
  context "when consuming xml" do
18
18
  should "return a valid Advice instance" do
19
- advice = Advice.from_xml('<saml:Advice></saml:Advice>')
19
+ advice = Advice.from_xml('<saml:Advice xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"></saml:Advice>')
20
20
  assert_not_nil(advice)
21
21
  assert advice.valid?
22
22
  end
@@ -89,7 +89,7 @@ class AssertionTest < Test::Unit::TestCase
89
89
  should "optionally include advice" do
90
90
  uri = 'http://example.com/some_advice'
91
91
  advice = Advice.new
92
- advice.assertions << AssertionIDRef.new(UUID.new)
92
+ advice.assertions << AssertionIDRef.new(UUID.new.generate)
93
93
  advice.assertions << AssertionURIRef.new(uri) # a URI
94
94
  @assertion.advice << advice
95
95
  xml = @assertion.to_xml
@@ -106,7 +106,7 @@ class AssertionTest < Test::Unit::TestCase
106
106
  context "when consuming xml" do
107
107
  should "return a valid Assertion instance" do
108
108
  xml_fragment = %Q(
109
- <saml:Assertion>
109
+ <saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
110
110
  <saml:Issuer>Example</saml:Issuer>
111
111
  <saml:Subject>Anthony</saml:Subject>
112
112
  </saml:Assertion>
@@ -122,7 +122,7 @@ class AssertionTest < Test::Unit::TestCase
122
122
  context "where there is no saml:Subject element" do
123
123
  should "raise a validation error" do
124
124
  xml_fragment = %Q(
125
- <saml:Assertion>
125
+ <saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
126
126
  <saml:Issuer>Example</saml:Issuer>
127
127
  </saml:Assertion>
128
128
  )
@@ -156,7 +156,7 @@ class AssertionTest < Test::Unit::TestCase
156
156
  end
157
157
  context "when consuming xml" do
158
158
  should "return a valid AssertionURIRef instance" do
159
- assertion_ref = AssertionURIRef.from_xml('<saml:AssertionURIRef>some_uri</saml:AssertionURIRef>')
159
+ assertion_ref = AssertionURIRef.from_xml('<saml:AssertionURIRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">some_uri</saml:AssertionURIRef>')
160
160
  assert_not_nil assertion_ref
161
161
  assert_equal 'some_uri', assertion_ref.uri
162
162
  assert assertion_ref.valid?
@@ -182,7 +182,7 @@ class AssertionTest < Test::Unit::TestCase
182
182
  end
183
183
  context "when consuming xml" do
184
184
  should "return a valid AssertionIDRef instance" do
185
- assertion_ref = AssertionIDRef.from_xml('<saml:AssertionIDRef>some_id</saml:AssertionIDRef>')
185
+ assertion_ref = AssertionIDRef.from_xml('<saml:AssertionIDRef xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">some_id</saml:AssertionIDRef>')
186
186
  assert_not_nil assertion_ref
187
187
  assert_equal 'some_id', assertion_ref.id
188
188
  assert assertion_ref.valid?
data/test/issuer_test.rb CHANGED
@@ -13,11 +13,12 @@ class IssuerTest < Test::Unit::TestCase
13
13
  end
14
14
  context "when producing xml" do
15
15
  should "always include format and value" do
16
- assert_equal '<saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">Some Issuer</saml:Issuer>', @identifier.to_xml
16
+ assert @identifier.to_xml.include? 'Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity"'
17
+ assert @identifier.to_xml.include? 'Some Issuer'
17
18
  end
18
19
  should "optionally include a name qualifier" do
19
20
  @identifier.name_qualifier = 'a_name_qualifier'
20
- assert_equal '<saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity" NameQualifier="a_name_qualifier">Some Issuer</saml:Issuer>', @identifier.to_xml
21
+ assert @identifier.to_xml.include? 'NameQualifier="a_name_qualifier"'
21
22
  end
22
23
  should "optionally include an service provider name qualifier" do
23
24
  @identifier.sp_name_qualifier = 'an_sp_name_qualifier'
data/test/name_test.rb CHANGED
@@ -13,11 +13,12 @@ class NameTest < Test::Unit::TestCase
13
13
  end
14
14
  context "when producing xml" do
15
15
  should "always include format and value" do
16
- assert_equal '<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">example</saml:NameID>', @name.to_xml
16
+ assert @name.to_xml.include? 'Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"'
17
+ assert @name.to_xml.include? 'example'
17
18
  end
18
19
  should "optionally include a name qualifier" do
19
20
  @name.name_qualifier = 'a_name_qualifier'
20
- assert_equal '<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" NameQualifier="a_name_qualifier">example</saml:NameID>', @name.to_xml
21
+ assert @name.to_xml.include? 'NameQualifier="a_name_qualifier"'
21
22
  end
22
23
  should "optionally include an service provider name qualifier" do
23
24
  @name.sp_name_qualifier = 'an_sp_name_qualifier'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scashin133-rsaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Eden
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-12 00:00:00 -08:00
12
+ date: 2010-02-16 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -44,9 +44,6 @@ extra_rdoc_files:
44
44
  - LICENSE
45
45
  - README
46
46
  files:
47
- - .autotest
48
- - .gitignore
49
- - LICENSE
50
47
  - README
51
48
  - Rakefile
52
49
  - lib/rsaml.rb
@@ -112,39 +109,7 @@ files:
112
109
  - lib/xml_sig/signature_method.rb
113
110
  - lib/xml_sig/signed_info.rb
114
111
  - lib/xml_sig/transform.rb
115
- - scashin133-rsaml.gemspec
116
- - test/action_namespace_test.rb
117
- - test/action_test.rb
118
- - test/advice_test.rb
119
- - test/assertion_test.rb
120
- - test/attribute_test.rb
121
- - test/authentication_context_test.rb
122
- - test/conditions_test.rb
123
- - test/evidence_test.rb
124
- - test/identifier_test.rb
125
- - test/issuer_test.rb
126
- - test/name_test.rb
127
- - test/parser_test.rb
128
- - test/protocol/assertion_id_request_test.rb
129
- - test/protocol/attribute_query_test.rb
130
- - test/protocol/authn_query_test.rb
131
- - test/protocol/authn_request_test.rb
132
- - test/protocol/authz_decision_query_test.rb
133
- - test/protocol/idp_list_test.rb
134
- - test/protocol/request_test.rb
135
- - test/protocol/response_test.rb
136
- - test/protocol/scoping_test.rb
137
- - test/protocol/status_code_test.rb
138
- - test/protocol/status_test.rb
139
- - test/proxy_restriction_test.rb
140
- - test/rsaml_test.rb
141
- - test/sample_data/attribute_query.xml
142
- - test/statement_test.rb
143
- - test/subject_locality_test.rb
144
- - test/subject_test.rb
145
- - test/test_helper.rb
146
- - test/xml_sig/canonicalization_test.rb
147
- - test/xml_sig/iso-8859-1.txt
112
+ - LICENSE
148
113
  has_rdoc: true
149
114
  homepage: http://github.com/scashin133/rsaml
150
115
  licenses: []
data/.autotest DELETED
@@ -1,10 +0,0 @@
1
- module Autotest::CustomTestMatch
2
- Autotest.add_hook :initialize do |at|
3
- at.add_mapping(/test/) do |f, _|
4
- at.files_matching(/_test\.rb$/)
5
- end
6
- at.add_mapping(/lib\/.*/) do |f, _|
7
- at.files_matching(/_test\.rb$/)
8
- end
9
- end
10
- end
data/.gitignore DELETED
@@ -1,2 +0,0 @@
1
- uuid.state
2
- rdoc
@@ -1,180 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{scashin133-rsaml}
8
- s.version = "0.1.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Anthony Eden"]
12
- s.date = %q{2010-02-12}
13
- s.description = %q{RSAML is a SAML implementation in Ruby. RSAML currently implements the elements defined in the SAML-Core 2.0
14
- specification by defining an object model that mimics the structure of SAML. Method names and attributes have been made
15
- ruby-friendly and documentation is provided for each class and method. In certain cases the SAML specification is
16
- referenced directly and should be considered the final say whenever a question arises regarding SAML implementation.
17
- }
18
- s.email = ["anthonyeden@gmail.com", "scashin133@gmail.com"]
19
- s.extra_rdoc_files = [
20
- "LICENSE",
21
- "README"
22
- ]
23
- s.files = [
24
- ".autotest",
25
- ".gitignore",
26
- "LICENSE",
27
- "README",
28
- "Rakefile",
29
- "lib/rsaml.rb",
30
- "lib/rsaml/action.rb",
31
- "lib/rsaml/action_namespace.rb",
32
- "lib/rsaml/advice.rb",
33
- "lib/rsaml/assertion.rb",
34
- "lib/rsaml/attribute.rb",
35
- "lib/rsaml/audience.rb",
36
- "lib/rsaml/authentication_context.rb",
37
- "lib/rsaml/authn_context/README",
38
- "lib/rsaml/authn_context/authentication_context_declaration.rb",
39
- "lib/rsaml/authn_context/identification.rb",
40
- "lib/rsaml/authn_context/physical_verification.rb",
41
- "lib/rsaml/condition.rb",
42
- "lib/rsaml/conditions.rb",
43
- "lib/rsaml/encrypted.rb",
44
- "lib/rsaml/errors.rb",
45
- "lib/rsaml/evidence.rb",
46
- "lib/rsaml/ext/string.rb",
47
- "lib/rsaml/identifier.rb",
48
- "lib/rsaml/identifier/base.rb",
49
- "lib/rsaml/identifier/issuer.rb",
50
- "lib/rsaml/identifier/name.rb",
51
- "lib/rsaml/parser.rb",
52
- "lib/rsaml/protocol.rb",
53
- "lib/rsaml/protocol/artifact_resolve.rb",
54
- "lib/rsaml/protocol/assertion_id_request.rb",
55
- "lib/rsaml/protocol/authn_request.rb",
56
- "lib/rsaml/protocol/idp_entry.rb",
57
- "lib/rsaml/protocol/idp_list.rb",
58
- "lib/rsaml/protocol/message.rb",
59
- "lib/rsaml/protocol/name_id_policy.rb",
60
- "lib/rsaml/protocol/query.rb",
61
- "lib/rsaml/protocol/query/attribute_query.rb",
62
- "lib/rsaml/protocol/query/authn_query.rb",
63
- "lib/rsaml/protocol/query/authz_decision_query.rb",
64
- "lib/rsaml/protocol/query/subject_query.rb",
65
- "lib/rsaml/protocol/request.rb",
66
- "lib/rsaml/protocol/requested_authn_context.rb",
67
- "lib/rsaml/protocol/response.rb",
68
- "lib/rsaml/protocol/scoping.rb",
69
- "lib/rsaml/protocol/status.rb",
70
- "lib/rsaml/protocol/status_code.rb",
71
- "lib/rsaml/proxy_restriction.rb",
72
- "lib/rsaml/statement.rb",
73
- "lib/rsaml/statement/attribute_statement.rb",
74
- "lib/rsaml/statement/authentication_statement.rb",
75
- "lib/rsaml/statement/authorization_decision_statement.rb",
76
- "lib/rsaml/statement/base.rb",
77
- "lib/rsaml/subject.rb",
78
- "lib/rsaml/subject_confirmation.rb",
79
- "lib/rsaml/subject_confirmation_data.rb",
80
- "lib/rsaml/subject_locality.rb",
81
- "lib/rsaml/validatable.rb",
82
- "lib/rsaml/version.rb",
83
- "lib/xml_enc.rb",
84
- "lib/xml_sig.rb",
85
- "lib/xml_sig/canonicalization_method.rb",
86
- "lib/xml_sig/key_info.rb",
87
- "lib/xml_sig/reference.rb",
88
- "lib/xml_sig/signature.rb",
89
- "lib/xml_sig/signature_method.rb",
90
- "lib/xml_sig/signed_info.rb",
91
- "lib/xml_sig/transform.rb",
92
- "scashin133-rsaml.gemspec",
93
- "test/action_namespace_test.rb",
94
- "test/action_test.rb",
95
- "test/advice_test.rb",
96
- "test/assertion_test.rb",
97
- "test/attribute_test.rb",
98
- "test/authentication_context_test.rb",
99
- "test/conditions_test.rb",
100
- "test/evidence_test.rb",
101
- "test/identifier_test.rb",
102
- "test/issuer_test.rb",
103
- "test/name_test.rb",
104
- "test/parser_test.rb",
105
- "test/protocol/assertion_id_request_test.rb",
106
- "test/protocol/attribute_query_test.rb",
107
- "test/protocol/authn_query_test.rb",
108
- "test/protocol/authn_request_test.rb",
109
- "test/protocol/authz_decision_query_test.rb",
110
- "test/protocol/idp_list_test.rb",
111
- "test/protocol/request_test.rb",
112
- "test/protocol/response_test.rb",
113
- "test/protocol/scoping_test.rb",
114
- "test/protocol/status_code_test.rb",
115
- "test/protocol/status_test.rb",
116
- "test/proxy_restriction_test.rb",
117
- "test/rsaml_test.rb",
118
- "test/sample_data/attribute_query.xml",
119
- "test/statement_test.rb",
120
- "test/subject_locality_test.rb",
121
- "test/subject_test.rb",
122
- "test/test_helper.rb",
123
- "test/xml_sig/canonicalization_test.rb",
124
- "test/xml_sig/iso-8859-1.txt"
125
- ]
126
- s.homepage = %q{http://github.com/scashin133/rsaml}
127
- s.rdoc_options = ["--charset=UTF-8"]
128
- s.require_paths = ["lib"]
129
- s.rubygems_version = %q{1.3.5}
130
- s.summary = %q{Ruby implementation of the SAML 2.0 Specification}
131
- s.test_files = [
132
- "test/action_namespace_test.rb",
133
- "test/action_test.rb",
134
- "test/advice_test.rb",
135
- "test/assertion_test.rb",
136
- "test/attribute_test.rb",
137
- "test/authentication_context_test.rb",
138
- "test/conditions_test.rb",
139
- "test/evidence_test.rb",
140
- "test/identifier_test.rb",
141
- "test/issuer_test.rb",
142
- "test/name_test.rb",
143
- "test/parser_test.rb",
144
- "test/protocol/assertion_id_request_test.rb",
145
- "test/protocol/attribute_query_test.rb",
146
- "test/protocol/authn_query_test.rb",
147
- "test/protocol/authn_request_test.rb",
148
- "test/protocol/authz_decision_query_test.rb",
149
- "test/protocol/idp_list_test.rb",
150
- "test/protocol/request_test.rb",
151
- "test/protocol/response_test.rb",
152
- "test/protocol/scoping_test.rb",
153
- "test/protocol/status_code_test.rb",
154
- "test/protocol/status_test.rb",
155
- "test/proxy_restriction_test.rb",
156
- "test/rsaml_test.rb",
157
- "test/statement_test.rb",
158
- "test/subject_locality_test.rb",
159
- "test/subject_test.rb",
160
- "test/test_helper.rb",
161
- "test/xml_sig/canonicalization_test.rb"
162
- ]
163
-
164
- if s.respond_to? :specification_version then
165
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
166
- s.specification_version = 3
167
-
168
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
169
- s.add_runtime_dependency(%q<activesupport>, [">= 2.3.4"])
170
- s.add_runtime_dependency(%q<uuid>, [">= 2.1.1"])
171
- else
172
- s.add_dependency(%q<activesupport>, [">= 2.3.4"])
173
- s.add_dependency(%q<uuid>, [">= 2.1.1"])
174
- end
175
- else
176
- s.add_dependency(%q<activesupport>, [">= 2.3.4"])
177
- s.add_dependency(%q<uuid>, [">= 2.1.1"])
178
- end
179
- end
180
-
@@ -1,8 +0,0 @@
1
- <?xml version="1.0"?>
2
-
3
- <samlp:AttributeQuery>
4
- <saml:Subject>
5
- <saml:NameID>Anthony Eden</saml:NameID>
6
- </saml:Subject>
7
- <saml:Attribute Name="Name" />
8
- </samlp:AttributeQuery>
@@ -1 +0,0 @@
1
- Caf� �