mace-opensaml-users - Re: SAMLNameIdentifier.equals
Subject: OpenSAML user discussion
List archive
- From: Chad La Joie <>
- To: OpenSAML <>
- Subject: Re: SAMLNameIdentifier.equals
- Date: Thu, 12 Jan 2006 17:43:26 -0500
- Organization: UIS - Project Sentinel
Because the equals() being used is Object.equals() which simply checks for reference equality, i.e. nameid1 == nameid2. Yes, the class should override equals() if there is a thought that equals() will be used in that manner.
Tom Scavo wrote:
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
--
Chad La Joie 2052-C Harris Bldg.
OIS-Middleware 202.687.0124
- SAMLNameIdentifier.equals, Tom Scavo, 01/12/2006
- Re: SAMLNameIdentifier.equals, Chad La Joie, 01/12/2006
- RE: SAMLNameIdentifier.equals, Scott Cantor, 01/12/2006
- Re: SAMLNameIdentifier.equals, Chad La Joie, 01/13/2006
- Re: SAMLNameIdentifier.equals, Tom Scavo, 01/13/2006
- RE: SAMLNameIdentifier.equals, Scott Cantor, 01/13/2006
- Re: SAMLNameIdentifier.equals, Tom Scavo, 01/13/2006
- RE: SAMLNameIdentifier.equals, Scott Cantor, 01/13/2006
- Re: SAMLNameIdentifier.equals, Tom Scavo, 01/13/2006
- RE: SAMLNameIdentifier.equals, Scott Cantor, 01/13/2006
- Re: SAMLNameIdentifier.equals, Tom Scavo, 01/13/2006
- Re: SAMLNameIdentifier.equals, Tom Scavo, 01/13/2006
- RE: SAMLNameIdentifier.equals, Scott Cantor, 01/13/2006
- Re: SAMLNameIdentifier.equals, Tom Scavo, 01/13/2006
- Re: SAMLNameIdentifier.equals, Chad La Joie, 01/13/2006
- RE: SAMLNameIdentifier.equals, Scott Cantor, 01/12/2006
- Re: SAMLNameIdentifier.equals, Tom Scavo, 01/13/2006
- Re: SAMLNameIdentifier.equals, Chad La Joie, 01/12/2006
Archive powered by MHonArc 2.6.16.