Skip to Content.
Sympa Menu

mace-opensaml-users - RE: bug with artifact builder

Subject: OpenSAML user discussion

List archive

RE: bug with artifact builder


Chronological Thread 
  • From: Jeff Brewer <>
  • To: "" <>
  • Subject: RE: bug with artifact builder
  • Date: Wed, 16 May 2007 01:50:12 -0700
  • Accept-language: en-US
  • Acceptlanguage: en-US
  • Z-usanet-msgid: XID782LePiYs0132X38

Thanks for the fix.

Sorry to bug you again, but SAML2ArtifactType0004.getRemainingArtifact also
seems to be only returning the message handle part.

public byte[] getRemainingArtifact() {
byte[] remainingArtifact = new byte[20];

System.arraycopy(getSourceID(), 0, remainingArtifact, 0, 20);
System.arraycopy(getMessageHandle(), 0, remainingArtifact, 0, 20);

return remainingArtifact;
}

Seems like this should be:
public byte[] getRemainingArtifact() {
byte[] remainingArtifact = new byte[40];

System.arraycopy(getSourceID(), 0, remainingArtifact, 0, 20);
System.arraycopy(getMessageHandle(), 0, remainingArtifact, 20, 20);

return remainingArtifact;
}

Jeff

-----Original Message-----
From: Chad La Joie
[mailto:]
Sent: Tuesday, May 15, 2007 6:38 PM
To:

Subject: Re: bug with artifact builder

Ah yep, I think you're right. Fixed in rev 935

Jeff Brewer wrote:
> Given the code to build an artifact:
>
> SAML2ArtifactType0004Builder artifactBuilder = new
> SAML2ArtifactType0004Builder();
> SAML2ArtifactType0004 artifactObject =
> artifactBuilder.buildArtifact("PAYCYCLEPAYCYCLEPAYC");
> artifactObject.setEndpointIndex(new byte[] {0,0});
> artifactObject.setMessageHandle("00000000000000000001".getBytes());
> String encode = artifactObject.base64Encode();
>
> I get an exception (ArrayIndexOutOfBoundsException) in
> AbstractSAML2Artifact.getArtifactBytes (line 64)
>
> public byte[] getArtifactBytes() {
> byte[] remainingArtifact = getRemainingArtifact();
> byte[] artifact = new byte[4 + remainingArtifact.length];
>
> System.arraycopy(getTypeCode(), 0, artifact, 0, 2);
> System.arraycopy(getEndpointIndex(), 0, artifact, 2, 2);
> System.arraycopy(remainingArtifact, 0, artifact, 4,
> artifact.length);
>
> return artifact;
> }
>
> I think line 64 should be:
>
> System.arraycopy(remainingArtifact, 0, artifact, 4,
> remainingArtifact.length);
>
> Jeff Brewer
>

--
Chad La Joie 2052-C Harris Bldg
OIS-Middleware 202.687.0124






Archive powered by MHonArc 2.6.16.

Top of Page