Skip to Content.
Sympa Menu

mace-opensaml-users - SAMLNameIdentifier.equals

Subject: OpenSAML user discussion

List archive

SAMLNameIdentifier.equals


Chronological Thread 
  • From: Tom Scavo <>
  • To: OpenSAML <>
  • Subject: SAMLNameIdentifier.equals
  • Date: Thu, 12 Jan 2006 17:40:11 -0500
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=HA4Up6liQOz9FcJvOINOi34sqgGwKqymiodnF4w9gEPmx3RNVjLk1g9UxEOnNPybzwcN0/TsnBA34je4Szapcb3wU5Zyset3QpOtmRcSGGLCwP0g77yYwDnxYQazDo1heeFAsNXi025BGCvMIZxep3CPjw7+P7IFYj3AVdeKzKQ=

The unit test

public void testSAMLNameIdentifier() throws Exception {
SAMLNameIdentifier nameid1 =
SAMLNameIdentifier.getInstance(new FileInputStream(xmlpath));
SAMLNameIdentifier nameid2 = (SAMLNameIdentifier) nameid1.clone();
assertEquals("Name identifiers are not equal", nameid1, nameid2);
}

fails with the following error message:

Name identifiers are not equal expected:<<NameIdentifier
xmlns="urn:oasis:names:tc:SAML:1.0:assertion"
Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName">uid=By-Tor,ou=tobes,dc=hades,dc=com</NameIdentifier>>
but was:<<NameIdentifier xmlns="urn:oasis:names:tc:SAML:1.0:assertion"
Format="urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName">uid=By-Tor,ou=tobes,dc=hades,dc=com</NameIdentifier>>

If I replace the call to assertEquals with

assertEquals("Serialized name identifiers are not equal",
nameid1.toString(), nameid2.toString());

the test succeeds.

Why does a straight 'equals' test fail? Should SAMLNameIdentifier (or
its superclass SAMLObject) define an 'equals' method?

Thanks,
Tom



Archive powered by MHonArc 2.6.16.

Top of Page