mace-opensaml-users - Re: SAMLArtifact class
Subject: OpenSAML user discussion
List archive
- From: Tom Scavo <>
- To: Walter Hoehn <>
- Cc:
- Subject: Re: SAMLArtifact class
- Date: Sat, 15 Jan 2005 15:58:04 -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=LrQIJ9a1xZ/h6Jpq68rE0BogQYyQm0NSLGqHS2ZAd1K9N7hGL6KwYidNBpIggU6n4SVn27mZu6VCPzUcy+byYS0vB8tuLlL/AE13zd3fmxrPtgez7OCk10h1CfRu7y6ZGSPIb6hKLBtI9QqHWDcrkUL2GV7v4VaSqY3o3pOwIR0=
Hi Walter,
I rewrote methods recoverAssertion and generateArtifact from
BaseArtifactMapper (with minimal invasion) to show you what it would
be like using the SAMLArtifact classes. Btw, all of this has been
implemented and tested except the parse method (which is tricky).
In addition to SAMLArtifactType01, I have also implemented
SAMLArtifactType02, LibertyArtifactType03, and SAMLArtifactType04,
which show that SAMLArtifact may be easily extended in various
directions. All of these classes implement an interface called
Artifact.
Hope this helps,
Tom
import org.opensaml.SAMLArtifact;
import org.opensaml.SAMLArtifactType01;
public ArtifactMapping recoverAssertion(String encodedArtifact) {
try {
//Decode the artifact
SAMLArtifact artifact =
SAMLArtifact.parse(encodedArtifact);
if
(artifact.getTypeCode().equals(SAMLArtifactType01.TYPE_CODE)) {
//Grab the assertion handle
byte[] assertionHandle = ((SAMLArtifactType01)
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:
SAMLArtifactType01 artifact;
try {
artifact = new SAMLArtifactType01(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 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
- SAMLArtifact class, Tom Scavo, 01/13/2005
- Re: SAMLArtifact class, Walter Hoehn, 01/13/2005
- Re: SAMLArtifact class, Tom Scavo, 01/13/2005
- Re: SAMLArtifact class, Walter Hoehn, 01/13/2005
- Re: SAMLArtifact class, Tom Scavo, 01/15/2005
- Re: SAMLArtifact class, Tom Scavo, 01/21/2005
- Re: SAMLArtifact class, Tom Scavo, 01/15/2005
- Re: SAMLArtifact class, Walter Hoehn, 01/13/2005
- Re: SAMLArtifact class, Tom Scavo, 01/13/2005
- RE: SAMLArtifact class, Scott Cantor, 01/13/2005
- Re: SAMLArtifact class, Tom Scavo, 01/21/2005
- Re: SAMLArtifact class, Tom Scavo, 01/25/2005
- RE: SAMLArtifact class, Scott Cantor, 01/25/2005
- Re: SAMLArtifact class, Walter Hoehn, 01/13/2005
Archive powered by MHonArc 2.6.16.