rsaml 0.1.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 (97) hide show
  1. data/LICENSE +0 -0
  2. data/README +13 -0
  3. data/Rakefile +136 -0
  4. data/lib/rsaml.rb +57 -0
  5. data/lib/rsaml/action.rb +57 -0
  6. data/lib/rsaml/action_namespace.rb +63 -0
  7. data/lib/rsaml/advice.rb +34 -0
  8. data/lib/rsaml/assertion.rb +192 -0
  9. data/lib/rsaml/attribute.rb +76 -0
  10. data/lib/rsaml/audience.rb +19 -0
  11. data/lib/rsaml/authentication_context.rb +34 -0
  12. data/lib/rsaml/authn_context/README +1 -0
  13. data/lib/rsaml/authn_context/authentication_context_declaration.rb +42 -0
  14. data/lib/rsaml/authn_context/identification.rb +10 -0
  15. data/lib/rsaml/authn_context/physical_verification.rb +24 -0
  16. data/lib/rsaml/condition.rb +13 -0
  17. data/lib/rsaml/conditions.rb +107 -0
  18. data/lib/rsaml/encrypted.rb +12 -0
  19. data/lib/rsaml/errors.rb +16 -0
  20. data/lib/rsaml/evidence.rb +21 -0
  21. data/lib/rsaml/ext/string.rb +5 -0
  22. data/lib/rsaml/identifier.rb +9 -0
  23. data/lib/rsaml/identifier/base.rb +23 -0
  24. data/lib/rsaml/identifier/issuer.rb +28 -0
  25. data/lib/rsaml/identifier/name.rb +55 -0
  26. data/lib/rsaml/parser.rb +23 -0
  27. data/lib/rsaml/protocol.rb +21 -0
  28. data/lib/rsaml/protocol/artifact_resolve.rb +14 -0
  29. data/lib/rsaml/protocol/assertion_id_request.rb +18 -0
  30. data/lib/rsaml/protocol/authn_request.rb +91 -0
  31. data/lib/rsaml/protocol/idp_entry.rb +18 -0
  32. data/lib/rsaml/protocol/idp_list.rb +28 -0
  33. data/lib/rsaml/protocol/message.rb +65 -0
  34. data/lib/rsaml/protocol/name_id_policy.rb +31 -0
  35. data/lib/rsaml/protocol/query.rb +12 -0
  36. data/lib/rsaml/protocol/query/attribute_query.rb +56 -0
  37. data/lib/rsaml/protocol/query/authn_query.rb +30 -0
  38. data/lib/rsaml/protocol/query/authz_decision_query.rb +40 -0
  39. data/lib/rsaml/protocol/query/subject_query.rb +22 -0
  40. data/lib/rsaml/protocol/request.rb +27 -0
  41. data/lib/rsaml/protocol/requested_authn_context.rb +34 -0
  42. data/lib/rsaml/protocol/response.rb +56 -0
  43. data/lib/rsaml/protocol/scoping.rb +33 -0
  44. data/lib/rsaml/protocol/status.rb +38 -0
  45. data/lib/rsaml/protocol/status_code.rb +84 -0
  46. data/lib/rsaml/proxy_restriction.rb +30 -0
  47. data/lib/rsaml/statement.rb +10 -0
  48. data/lib/rsaml/statement/attribute_statement.rb +27 -0
  49. data/lib/rsaml/statement/authentication_statement.rb +57 -0
  50. data/lib/rsaml/statement/authorization_decision_statement.rb +53 -0
  51. data/lib/rsaml/statement/base.rb +9 -0
  52. data/lib/rsaml/subject.rb +37 -0
  53. data/lib/rsaml/subject_confirmation.rb +35 -0
  54. data/lib/rsaml/subject_confirmation_data.rb +55 -0
  55. data/lib/rsaml/subject_locality.rb +27 -0
  56. data/lib/rsaml/validatable.rb +21 -0
  57. data/lib/rsaml/version.rb +9 -0
  58. data/lib/xml_enc.rb +3 -0
  59. data/lib/xml_sig.rb +11 -0
  60. data/lib/xml_sig/canonicalization_method.rb +43 -0
  61. data/lib/xml_sig/key_info.rb +55 -0
  62. data/lib/xml_sig/reference.rb +57 -0
  63. data/lib/xml_sig/signature.rb +29 -0
  64. data/lib/xml_sig/signature_method.rb +20 -0
  65. data/lib/xml_sig/signed_info.rb +27 -0
  66. data/lib/xml_sig/transform.rb +37 -0
  67. data/test/action_namespace_test.rb +93 -0
  68. data/test/action_test.rb +51 -0
  69. data/test/advice_test.rb +25 -0
  70. data/test/assertion_test.rb +192 -0
  71. data/test/attribute_test.rb +60 -0
  72. data/test/authentication_context_test.rb +26 -0
  73. data/test/conditions_test.rb +84 -0
  74. data/test/evidence_test.rb +33 -0
  75. data/test/identifier_test.rb +22 -0
  76. data/test/issuer_test.rb +33 -0
  77. data/test/name_test.rb +33 -0
  78. data/test/parser_test.rb +32 -0
  79. data/test/protocol/assertion_id_request_test.rb +19 -0
  80. data/test/protocol/attribute_query_test.rb +30 -0
  81. data/test/protocol/authn_query_test.rb +20 -0
  82. data/test/protocol/authn_request_test.rb +56 -0
  83. data/test/protocol/authz_decision_query_test.rb +31 -0
  84. data/test/protocol/idp_list_test.rb +15 -0
  85. data/test/protocol/request_test.rb +66 -0
  86. data/test/protocol/response_test.rb +68 -0
  87. data/test/protocol/scoping_test.rb +20 -0
  88. data/test/protocol/status_code_test.rb +34 -0
  89. data/test/protocol/status_test.rb +16 -0
  90. data/test/proxy_restriction_test.rb +20 -0
  91. data/test/rsaml_test.rb +12 -0
  92. data/test/statement_test.rb +101 -0
  93. data/test/subject_locality_test.rb +27 -0
  94. data/test/subject_test.rb +44 -0
  95. data/test/test_helper.rb +16 -0
  96. data/test/xml_sig/canonicalization_test.rb +19 -0
  97. metadata +187 -0
@@ -0,0 +1,60 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class AttributeTest < Test::Unit::TestCase
4
+ context "an attribute" do
5
+ setup do
6
+ @attribute = Attribute.new('email')
7
+ end
8
+ should "should be valid" do
9
+ assert_nothing_raised do
10
+ @attribute.validate
11
+ end
12
+ end
13
+ should "should not be valid if name is nil" do
14
+ assert_raise ValidationError do
15
+ @attribute.name = nil
16
+ @attribute.validate
17
+ end
18
+ end
19
+ context "when producing xml" do
20
+ should "always include a name attribute" do
21
+ assert_match(/<saml:Attribute Name="email"><\/saml:Attribute>/, @attribute.to_xml)
22
+ end
23
+ should "optionally include a NameFormat attribute" do
24
+ @attribute.name_format = 'http://host/name_format/email'
25
+ assert_match(/NameFormat="#{@attribute.name_format}"/, @attribute.to_xml)
26
+ end
27
+ should "optionally include a FriendlyName attribute" do
28
+ @attribute.friendly_name = 'email'
29
+ assert_match(/FriendlyName="#{@attribute.friendly_name}"/, @attribute.to_xml)
30
+ end
31
+ should "optionally include a single attribute value child element" do
32
+ @attribute.values << 'someone@somewhere.com'
33
+ assert_match(/<saml:AttributeValue>someone@somewhere.com<\/saml:AttributeValue>/, @attribute.to_xml)
34
+ end
35
+ should "optionally include multiple attribute value child elements" do
36
+ @attribute.values << 'someone@somewhere.com'
37
+ @attribute.values << 'someone@somewhereelse.com'
38
+ assert_match('<saml:AttributeValue>someone@somewhere.com</saml:AttributeValue>', @attribute.to_xml)
39
+ assert_match('<saml:AttributeValue>someone@somewhereelse.com</saml:AttributeValue>', @attribute.to_xml)
40
+ end
41
+ should "optionally include extra XML attributes" do
42
+ @attribute.extra_xml_attributes['foo'] = 'bar'
43
+ assert_match(/foo="bar"/, @attribute.to_xml)
44
+ end
45
+ end
46
+ end
47
+
48
+ context "an encrypted attribute" do
49
+ setup do
50
+ @encrypted_attribute = EncryptedAttribute.new
51
+ end
52
+ should_eventually "be valid" do
53
+ assert_nothing_raised do
54
+ @encrypted_attribute.validate
55
+ end
56
+ end
57
+ should_eventually "always include encrypted data"
58
+ should_eventually "optionally include encrypted keys"
59
+ end
60
+ end
@@ -0,0 +1,26 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class AuthenticationContextTest < Test::Unit::TestCase
4
+ context "an authentication context" do
5
+ setup do
6
+ @authn_context = AuthenticationContext.new
7
+ end
8
+ context "when producing xml" do
9
+ should "optionally have a class reference" do
10
+ @authn_context.class_reference = 'http://example.com/class_ref'
11
+ assert_equal '<saml:AuthnContext><saml:AuthnContextClassRef>http://example.com/class_ref</saml:AuthnContextClassRef></saml:AuthnContext>', @authn_context.to_xml
12
+ end
13
+ should "optionally have a context declaration" do
14
+ @authn_context.context_declaration = 'example'
15
+ assert_equal '<saml:AuthnContext><saml:AuthnContextDecl>example</saml:AuthnContextDecl></saml:AuthnContext>', @authn_context.to_xml
16
+ end
17
+ should "optionally have a context declaration ref" do
18
+ @authn_context.context_declaration_ref = 'http://example.com/declaration_ref'
19
+ assert_equal '<saml:AuthnContext><saml:AuthnContextDeclRef>http://example.com/declaration_ref</saml:AuthnContextDeclRef></saml:AuthnContext>', @authn_context.to_xml
20
+ end
21
+ should_eventually "optionally have zero or more authenticating authority instances" do
22
+
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,84 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class ConditionsTest < Test::Unit::TestCase
4
+ context "an conditions collection" do
5
+ setup do
6
+ @conditions = Conditions.new
7
+ end
8
+ should "have 0 conditions by default" do
9
+ assert_equal 0, @conditions.conditions.length
10
+ assert_equal 0, @conditions.length
11
+ end
12
+ should "be valid with 0 conditions" do
13
+ assert_nothing_raised do
14
+ @conditions.assert
15
+ end
16
+ end
17
+ should "be cacheable" do
18
+ assert @conditions.cache?
19
+ end
20
+ should "be able to add a condition" do
21
+ @conditions << Condition.new
22
+ assert_equal 1, @conditions.length
23
+ end
24
+
25
+ context "when asserting" do
26
+ should "fail an assertion for NotBefore if that value is in the future" do
27
+ @conditions.not_before = Time.now + 1000
28
+ assert_raise(AssertionError) { @conditions.assert }
29
+ end
30
+ should "fail an assertion for NotOnOrAfter if that value is now" do
31
+ @conditions.not_on_or_after = Time.now
32
+ assert_raise(AssertionError) { @conditions.assert }
33
+ end
34
+ should "fail an assertion for NotOnOrAfter if that value is in the past" do
35
+ @conditions.not_on_or_after = Time.now - 1000
36
+ assert_raise(AssertionError) { @conditions.assert }
37
+ end
38
+ should "assert without error if NotBefore is in the past" do
39
+ @conditions.not_before = Time.now - 1000
40
+ assert_nothing_raised do
41
+ @conditions.assert
42
+ end
43
+ end
44
+ should "assert without error if NotOnOrAfter is in the future" do
45
+ @conditions.not_on_or_after = Time.now + 1000
46
+ assert_nothing_raised do
47
+ @conditions.assert
48
+ end
49
+ end
50
+ end
51
+
52
+ context "when producing xml" do
53
+ setup do
54
+ @conditions = Conditions.new
55
+ end
56
+ should "optionally include NotBefore attribute" do
57
+ t = @conditions.not_before = Time.now
58
+ assert_equal %Q(<saml:Conditions NotBefore="#{t.xmlschema}"></saml:Conditions>), @conditions.to_xml
59
+ end
60
+ should "optionally include NotOnOrAfter attribute" do
61
+ t = @conditions.not_on_or_after = Time.now
62
+ assert_equal %Q(<saml:Conditions NotOnOrAfter="#{t.xmlschema}"></saml:Conditions>), @conditions.to_xml
63
+ end
64
+ should "optionally include conditions" do
65
+ @conditions << Condition.new
66
+ assert_equal "<saml:Conditions><saml:Condition/></saml:Conditions>", @conditions.to_xml
67
+ end
68
+ should "optionally include audience restriction" do
69
+ audience = Audience.new('http://example.org/audience_terms')
70
+ @conditions.audience_restrictions << audience
71
+ assert_equal "<saml:Conditions><saml:AudienceRestriction><saml:Audience>#{audience.uri}</saml:Audience></saml:AudienceRestriction></saml:Conditions>", @conditions.to_xml
72
+ end
73
+ should "optionally include a proxy restriction" do
74
+ proxy_restriction = ProxyRestriction.new
75
+ @conditions.proxy_restriction = proxy_restriction
76
+ assert_equal "<saml:Conditions><saml:ProxyRestriction></saml:ProxyRestriction></saml:Conditions>", @conditions.to_xml
77
+ end
78
+ should "optionally include a one time use" do
79
+ @conditions.one_time_use = true
80
+ assert_equal "<saml:Conditions><OneTimeUse/></saml:Conditions>", @conditions.to_xml
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,33 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class EvidenceTest < Test::Unit::TestCase
4
+ context "an evidence instance" do
5
+ setup do
6
+ @evidence = Evidence.new
7
+ end
8
+ should "not be valid unless at least one assertion is specified" do
9
+ assert_raise ValidationError do
10
+ @evidence.validate
11
+ end
12
+ end
13
+
14
+ context "when producing xml" do
15
+ should "optionally include an assertion id ref" do
16
+ @evidence.assertions << AssertionIDRef.new('149369035468035')
17
+ assert_match(/<saml:Evidence><saml:AssertionIDRef>149369035468035<\/saml:AssertionIDRef><\/saml:Evidence>/, @evidence.to_xml)
18
+ end
19
+ should "optionally include an assertion uri ref" do
20
+ @evidence.assertions << AssertionURIRef.new('http://xyz.com/assertion/uri')
21
+ assert_equal(
22
+ '<saml:Evidence><saml:AssertionURIRef>http://xyz.com/assertion/uri</saml:AssertionURIRef></saml:Evidence>',
23
+ @evidence.to_xml
24
+ )
25
+ end
26
+ should "optionally include an assertion" do
27
+ @evidence.assertions << Assertion.new(Identifier::Issuer.new('example'))
28
+ assert_match(/<saml:Evidence><saml:Assertion /, @evidence.to_xml)
29
+ end
30
+ should_eventually "optionally include an encrypted assertion"
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,22 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class IdentifierTest < Test::Unit::TestCase
4
+ context "an identifier" do
5
+ setup do
6
+ @identifier = Identifier::Base.new
7
+ end
8
+ context "when producing xml" do
9
+ should "always include value" do
10
+ assert_equal '<saml:BaseID></saml:BaseID>', @identifier.to_xml
11
+ end
12
+ should "optionally include a name qualifier" do
13
+ @identifier.name_qualifier = 'a_name_qualifier'
14
+ assert_equal '<saml:BaseID NameQualifier="a_name_qualifier"></saml:BaseID>', @identifier.to_xml
15
+ end
16
+ should "optionally include an service provider name qualifier" do
17
+ @identifier.sp_name_qualifier = 'an_sp_name_qualifier'
18
+ assert_equal '<saml:BaseID SPNameQualifier="an_sp_name_qualifier"></saml:BaseID>', @identifier.to_xml
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,33 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class IssuerTest < Test::Unit::TestCase
4
+ context "a name" do
5
+ setup do
6
+ @identifier = Identifier::Issuer.new('Some Issuer')
7
+ end
8
+ should "have a value" do
9
+ assert_equal 'Some Issuer', @identifier.value
10
+ end
11
+ should "have the entity format by default" do
12
+ assert_equal Identifier::Name.formats[:entity], @identifier.format
13
+ end
14
+ context "when producing xml" do
15
+ should "always include format and value" do
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'
18
+ end
19
+ should "optionally include a name qualifier" do
20
+ @identifier.name_qualifier = 'a_name_qualifier'
21
+ assert @identifier.to_xml.include? 'NameQualifier="a_name_qualifier"'
22
+ end
23
+ should "optionally include an service provider name qualifier" do
24
+ @identifier.sp_name_qualifier = 'an_sp_name_qualifier'
25
+ assert_equal '<saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity" SPNameQualifier="an_sp_name_qualifier">Some Issuer</saml:Issuer>', @identifier.to_xml
26
+ end
27
+ should "optionally include an service provider provided id" do
28
+ @identifier.sp_provided_id = 'sp-x'
29
+ assert_equal '<saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity" SPProvidedID="sp-x">Some Issuer</saml:Issuer>', @identifier.to_xml
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,33 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class NameTest < Test::Unit::TestCase
4
+ context "a name" do
5
+ setup do
6
+ @name = Identifier::Name.new('example')
7
+ end
8
+ should "have a value" do
9
+ assert_equal 'example', @name.value
10
+ end
11
+ should "have the unspecified format by default" do
12
+ assert_equal Identifier::Name.formats[:unspecified], @name.format
13
+ end
14
+ context "when producing xml" do
15
+ should "always include format and value" do
16
+ assert @name.to_xml.include? 'Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified"'
17
+ assert @name.to_xml.include? 'example'
18
+ end
19
+ should "optionally include a name qualifier" do
20
+ @name.name_qualifier = 'a_name_qualifier'
21
+ assert @name.to_xml.include? 'NameQualifier="a_name_qualifier"'
22
+ end
23
+ should "optionally include an service provider name qualifier" do
24
+ @name.sp_name_qualifier = 'an_sp_name_qualifier'
25
+ assert_equal '<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" SPNameQualifier="an_sp_name_qualifier">example</saml:NameID>', @name.to_xml
26
+ end
27
+ should "optionally include an service provider provided id" do
28
+ @name.sp_provided_id = 'sp-x'
29
+ assert_equal '<saml:NameID Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" SPProvidedID="sp-x">example</saml:NameID>', @name.to_xml
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,32 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class ParserTest < Test::Unit::TestCase
4
+ context "a parser" do
5
+ setup { @parser = Parser.new }
6
+ context "parsing an attribute query message" do
7
+ setup do
8
+ @attribute_query = @parser.parse(attribute_query_xml)
9
+ end
10
+ should "return an attribute query instance" do
11
+ assert @attribute_query.is_a?(Protocol::Query::AttributeQuery)
12
+ end
13
+ should "have 1 attribute" do
14
+ assert_equal 1, @attribute_query.attributes.length
15
+ end
16
+ should "have a subject of Anthony Eden" do
17
+ assert_equal 'Anthony Eden', @attribute_query.subject.identifier.value
18
+ end
19
+ should "have an attribute whose name is Name" do
20
+ assert_equal 'Name', @attribute_query.attributes.first.name
21
+ end
22
+ end
23
+ end
24
+
25
+ def attribute_query_xml
26
+ @attribute_query_xml ||= begin
27
+ open(File.dirname(__FILE__) + '/sample_data/attribute_query.xml') do |f|
28
+ f.read
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,19 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class AssertionIdRequestTest < Test::Unit::TestCase
4
+ include RSAML::Protocol
5
+ context "an assertion id request instance" do
6
+ setup do
7
+ @request = AssertionIDRequest.new
8
+ @request.assertion_id_refs << AssertionIDRef.new('xyz')
9
+ end
10
+ context "when producing xml" do
11
+ should "output the samlp:AssertionIDRequest element" do
12
+ assert_match '<samlp:AssertionIDRequest>', @request.to_xml
13
+ end
14
+ should "include the assertion id ref children" do
15
+ assert_match '<saml:AssertionIDRef>xyz</saml:AssertionIDRef>', @request.to_xml
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,30 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class AttributeQueryTest < Test::Unit::TestCase
4
+ include RSAML::Protocol::Query
5
+
6
+ context "an attribute query" do
7
+ setup do
8
+ @query = AttributeQuery.new(Subject.new('example'))
9
+ end
10
+ context "with attributes" do
11
+ setup do
12
+ @query.attributes << Attribute.new('email')
13
+ end
14
+ should "be valid" do
15
+ assert_nothing_raised { @query.validate }
16
+ end
17
+ should "not allow duplicate attributes" do
18
+ @query.attributes << Attribute.new('email')
19
+ assert_raise ValidationError do
20
+ @query.validate
21
+ end
22
+ end
23
+ end
24
+ context "when producing xml" do
25
+ should "include a subject" do
26
+ assert_match('<saml:Subject>example</saml:Subject>', @query.to_xml)
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class AuthnQueryTest < Test::Unit::TestCase
4
+ include RSAML::Protocol::Query
5
+
6
+ context "an authn query" do
7
+ setup do
8
+ @query = AuthnQuery.new(Subject.new('example'))
9
+ end
10
+ context "when producing xml" do
11
+ should "include a subject" do
12
+ assert_match('<saml:Subject>example</saml:Subject>', @query.to_xml)
13
+ end
14
+ should "optionally include a SessionIndex" do
15
+ @query.session_index = '123'
16
+ assert_match('<samlp:AuthnQuery SessionIndex="123"', @query.to_xml)
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,56 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ class AuthnRequestTest < Test::Unit::TestCase
4
+ include RSAML::Protocol
5
+ context "an authentication request instance" do
6
+ setup do
7
+ @request = AuthnRequest.new
8
+ end
9
+ should "be valid" do
10
+ assert_nothing_raised { @request.validate }
11
+ end
12
+ context "when producing xml" do
13
+ should "output the samlp:AuthnRequest element" do
14
+ assert_match '<samlp:AuthnRequest>', @request.to_xml
15
+ end
16
+ should "optionally include a subject child" do
17
+ @request.subject = Subject.new
18
+ assert_match '<saml:Subject></saml:Subject>', @request.to_xml
19
+ end
20
+ should "optionally include a name id policy child" do
21
+ name_id_policy = NameIdPolicy.new
22
+ name_id_policy.format = Identifier::Name.formats[:email_address]
23
+ @request.name_id_policy = name_id_policy
24
+ assert_match '<samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"', @request.to_xml
25
+ end
26
+ should "optionally include conditions" do
27
+ conditions = Conditions.new
28
+ @request.conditions = conditions
29
+ assert_match '<saml:Conditions', @request.to_xml
30
+ end
31
+ should_eventually "optionally include requested authn context" do
32
+
33
+ end
34
+ should "optionally include scoping" do
35
+ scoping = Scoping.new
36
+ @request.scoping = scoping
37
+ assert_match '<samlp:Scoping', @request.to_xml
38
+ end
39
+ should "optionally include force authn" do
40
+ @request.force_authn = true
41
+ assert_match '<samlp:AuthnRequest ForceAuthn="true"', @request.to_xml
42
+ end
43
+ should "optionally include passive flag" do
44
+ @request.is_passive = true
45
+ assert_match '<samlp:AuthnRequest IsPassive="true"', @request.to_xml
46
+ end
47
+ should "optionally include AssertionConsumerServiceURL" do
48
+
49
+ end
50
+ should "optionally include a provider name" do
51
+ @request.provider_name = 'example'
52
+ assert_match '<samlp:AuthnRequest ProviderName="example"', @request.to_xml
53
+ end
54
+ end
55
+ end
56
+ end