Skip to Content.
Sympa Menu

mace-opensaml-users - Re: SAMLArtifact class

Subject: OpenSAML user discussion

List archive

Re: SAMLArtifact class


Chronological Thread 
  • From: Tom Scavo <>
  • To: Walter Hoehn <>
  • Cc:
  • Subject: Re: SAMLArtifact class
  • Date: Fri, 21 Jan 2005 16:50:18 -0500
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=PeNIBefrdnf1fRR6u3MC376VKIUPv6rqjJg5b/OKqsHMyqlVfjlba3MRS2qNF0iC9VPqedKl6XrRCZt5R6FPC2IUxNF/xGxEcpRfyBSgmvDmK6z/cTsgXM78bUgjA3ZLQi1CQd3JR5McyLMLezB/PLBS1luhyqdi+znqNPF7Q74=

Walter, here are updated methods for the shib implementation you're
working on. Note how easy it would be to support multiple artifacts
of arbitrary type.

import org.opensaml.SAMLArtifact;
import org.opensaml.SAMLArtifactType0001;

public ArtifactMapping recoverAssertion(String encodedArtifact) {

try {
//Decode the artifact
Artifact.Parser parser = SAMLArtifact.getTypeCode(
encodedArtifact
).getParser();
Artifact artifact = parser.parse( encodedArtifact );
if
(artifact.getTypeCode().equals(SAMLArtifactType0001.TYPE_CODE)) {

//Grab the assertion handle
byte[] assertionHandle =
((SAMLArtifactType0001)
artifact).getAssertionHandle();
String stringHandle = new
String(assertionHandle);

//delegate recovery to extenders
return recoverAssertionImpl(stringHandle);

} else {
log.error("Incorrect artifact type code.");
return null;
}

} catch (Exception e) {
log.error("Unable to parse artifact.");
return null;
}
}

public String generateArtifact(SAMLAssertion assertion,
HSRelyingParty relyingParty) {

// Add SourceID
byte[] sourceID = new byte[20];
synchronized (md) {
sourceID =
md.digest(relyingParty.getIdentityProvider().getProviderId().getBytes());
}

// create a type 0x0001 artifact:
SAMLArtifactType0001 artifact;
try {
artifact = new SAMLArtifactType0001(sourceID);
} catch (Exception e) {
log.error("Unable to create artifact.");
return null;
}

// Cache the assertion handle
String assertionHandle = new
String(artifact.getAssertionHandle());

// Delegate adding to extenders
addAssertionImpl(assertionHandle, new
ArtifactMapping(assertionHandle, assertion, relyingParty));

// Return the encoded artifact
return artifact.encode();
}



On Sat, 15 Jan 2005 15:58:04 -0500, Tom Scavo
<>
wrote:
>
> I rewrote methods recoverAssertion and generateArtifact from
> BaseArtifactMapper (with minimal invasion) to show you what it would
> be like using the SAMLArtifact classes...
>
> public ArtifactMapping recoverAssertion(String encodedArtifact) {
>
> ...
> }
>
> public String generateArtifact(SAMLAssertion assertion,
> HSRelyingParty relyingParty) {
>
> ...
> }
>
> On Thu, 13 Jan 2005 12:22:53 -0600, Walter Hoehn
> <>
> wrote:
> > http://anoncvs.internet2.edu/cgi-bin/viewcvs.cgi/shibboleth/java/src/
> > edu/internet2/middleware/shibboleth/artifact/provider/
> > BaseArtifactMapper.java?rev=1.1&content-type=text/vnd.viewcvs-markup
>



Archive powered by MHonArc 2.6.16.

Top of Page