Skip to Content.
Sympa Menu

mace-opensaml-users - Re: SAMLNameIdentifier.equals

Subject: OpenSAML user discussion

List archive

Re: SAMLNameIdentifier.equals


Chronological Thread 
  • From: Tom Scavo <>
  • To: Scott Cantor <>
  • Cc: OpenSAML <>
  • Subject: Re: SAMLNameIdentifier.equals
  • Date: Fri, 13 Jan 2006 13:37:33 -0500
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=UGl7qGhhJ+s3fXlu8QvHkUyDoWLoBrgMhZOL+L0XYdnFBPx4Th3xmyDX2L9ycvQg4k0vH4zWMo/hP2cFPD2+LEghXQ4V+T41N173rEaRXdehuAAusm6EeFBfZJd/UIlUwclu3Hxjv7TvBY07qe4p+TULflWOfYsndvp9dAktXCE=

On 1/13/06, Scott Cantor
<>
wrote:
>
> I don't know whether Chad had planned to change this behavior or not. I'd
> have to see how it would work in the general case before I would change my
> mind.

Here's a possible implementation of equals in SAMLNameIdentifier:

public boolean equals(Object o) {
if (!( o instanceof SAMLNameIdentifier)) {return false;}
if (XML.isEmpty(this.format)) {return this.foo().equals(o);}
SAMLNameIdentifier nameid = (SAMLNameIdentifier) o;
if (XML.isEmpty(nameid.getFormat())) {return equals(nameid.foo());}
return nameid.getName().equals(this.name) &&
nameid.getNameQualifier().equals(this.nameQualifier) &&
nameid.getFormat().equals(this.format);
}

public SAMLNameIdentifier foo() {
String format = this.format;
if (XML.isEmpty(format)) {format = FORMAT_UNSPECIFIED;}
SAMLNameIdentifier nameid;
try {
nameid = SAMLNameIdentifier.getInstance(format);
} catch (SAMLException e) {
nameid = new SAMLNameIdentifier();
nameid.setFormat(format);
}
nameid.setName(this.name);
nameid.setNameQualifier(this.nameQualifier);
return nameid;
}

I don't know what to call foo. It's a canonicalizer for
NameIdentifiers (of sorts) but I don't want to use that word in this
context.

Note that this works regardless of whether or not FORMAT_UNSPECIFIED
is registered. If so, then presumably the handler would likewise call
foo() on its argument.

Tom



Archive powered by MHonArc 2.6.16.

Top of Page