-
-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #671 from SAML-Toolkits/slo_encrypted_nameid
Add support on LogoutRequest with Encrypted NameID
- Loading branch information
Showing
5 changed files
with
79 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0" ID="_c0348950-935b-0131-1060-782bcb56fcaa" IssueInstant="2014-03-21T19:20:13"> | ||
<saml:Issuer>https://app.onelogin.com/saml/metadata/SOMEACCOUNT</saml:Issuer> | ||
<saml:EncryptedID><xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Type="http://www.w3.org/2001/04/xmlenc#Element"><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes128-cbc"/><dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><xenc:EncryptedKey><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"/><xenc:CipherData><xenc:CipherValue>L99BsKQL2iq5chjY+wRj6AH3jYxv9L4tscPJaDdsPWvPG47toC903oxEhjd1p9EMWkSPqD/HclvRhjcNVmhfUa3clTMM5PpZS1+oin2cDNFgKDkEaCXsGRgfn44uUKbEfUHNaljC72qh0lBLnoJe7ZkJHbFMbsA8Cd4UBtHzp4Y=</xenc:CipherValue></xenc:CipherData></xenc:EncryptedKey></dsig:KeyInfo> | ||
<xenc:CipherData><xenc:CipherValue>+dLZt52QiV39ltBeRNUev0jlD9ReI7lM3EDgfktPgKeIs6bvsLz9feWhlnydd+NjbwXTsBQjEhm80/O8szYZZZpQB3H+khA76HJoFeDdhDgnVMqeXVWVkeSjcDFHg6TPLPyydSNcsBPBOqP093xCF7je0PUgkK45cj6aN/hs7TckxCbeuOv/klz6jxc24TyNoGg3Z1TA/HlS2ePVY77LhQgqhsZIL52LTG3BjAHVvpzSXyuYbeR5OeiYIM028Xyl</xenc:CipherValue> | ||
</xenc:CipherData> | ||
</xenc:EncryptedData></saml:EncryptedID></samlp:LogoutRequest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ class RubySamlTest < Minitest::Test | |
|
||
let(:settings) { OneLogin::RubySaml::Settings.new } | ||
let(:logout_request) { OneLogin::RubySaml::SloLogoutrequest.new(logout_request_document) } | ||
let(:logout_request_encrypted_nameid) { OneLogin::RubySaml::SloLogoutrequest.new(logout_request_encrypted_nameid_document) } | ||
let(:invalid_logout_request) { OneLogin::RubySaml::SloLogoutrequest.new(invalid_logout_request_document) } | ||
|
||
before do | ||
|
@@ -87,6 +88,18 @@ class RubySamlTest < Minitest::Test | |
it "extract the value of the name id element" do | ||
assert_equal "[email protected]", logout_request.nameid | ||
end | ||
|
||
it 'is not possible when encryptID but no private key' do | ||
assert_raises(OneLogin::RubySaml::ValidationError, "An EncryptedID found and no SP private key found on the settings to decrypt it") do | ||
assert_equal "[email protected]", logout_request_encrypted_nameid.nameid | ||
end | ||
end | ||
|
||
it "extract the value of the name id element inside an EncryptedId" do | ||
settings.private_key = ruby_saml_key_text | ||
logout_request_encrypted_nameid.settings = settings | ||
assert_equal "[email protected]", logout_request_encrypted_nameid.nameid | ||
end | ||
end | ||
|
||
describe "#nameid_format" do | ||
|
@@ -95,6 +108,18 @@ class RubySamlTest < Minitest::Test | |
it "extract the format attribute of the name id element" do | ||
assert_equal "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", logout_request.nameid_format | ||
end | ||
|
||
it 'is not possible when encryptID but no private key' do | ||
assert_raises(OneLogin::RubySaml::ValidationError, "An EncryptedID found and no SP private key found on the settings to decrypt it") do | ||
assert_equal "[email protected]", logout_request_encrypted_nameid.nameid | ||
end | ||
end | ||
|
||
it "extract the format attribute of the name id element" do | ||
settings.private_key = ruby_saml_key_text | ||
logout_request_encrypted_nameid.settings = settings | ||
assert_equal "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress", logout_request_encrypted_nameid.nameid_format | ||
end | ||
end | ||
|
||
describe "#issuer" do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters