Skip to Content.
Sympa Menu

mace-opensaml-users - Re: Re: Problem in creating Assertion Object

Subject: OpenSAML user discussion

List archive

Re: Re: Problem in creating Assertion Object


Chronological Thread 
  • From:
  • To:
  • Subject: Re: Re: Problem in creating Assertion Object
  • Date: Sun, 27 Aug 2006 20:44:32 -0400 (EDT)

hi,
i am using svn trunk code of opensaml, when i am trying to create a
assertion and than print it. i am getting it as null

output: [saml:Asserton: null]
can you please help me what could be going wrong.

thanks
harsha


Configuration.init();
XMLObjectBuilderFactory builderFactory =
Configuration.getBuilderFactory();

// Get the assertion builder based on the assertion element name
AssertionBuilder builder = (AssertionBuilder)
builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME);
// Create the assertion
Assertion assertion = builder.buildObject ();

// set Id
assertion.setID ("12345");
IssuerBuilder ib = new IssuerBuilder();
// set Issuer
Issuer i = ib.buildObject();
i.setValue("Hello World");
assertion.setIssuer(i);
// set IssueInstant
DateTime dt = new DateTime();
assertion.setIssueInstant(dt);
// set Conditions
ConditionsBuilder cb = new ConditionsBuilder();
Conditions cd = cb.buildObject();
cd.setNotOnOrAfter(dt);
assertion.setConditions(cd);

// set Subject

// Get the marshaller factory
MarshallerFactory marshallerFactory = Configuration.getMarshallerFactory();

// Get the Subject marshaller
Marshaller marshaller = marshallerFactory.getMarshaller(assertion);

// Marshall the Subject
Element subjectElement = marshaller.marshall(assertion);
System.out.println(subjectElement);



Archive powered by MHonArc 2.6.16.

Top of Page