/** {@inheritDoc} */ protected void processAttribute(XMLObject samlObject, Attr attribute) throws UnmarshallingException { Assertion assertion = (Assertion) samlObject; if (attribute.getLocalName().equals(Assertion.VERSION_ATTRIB_NAME)) { assertion.setVersion(SAMLVersion.valueOf(attribute.getValue())); } else if (attribute.getLocalName().equals(Assertion.ISSUE_INSTANT_ATTRIB_NAME) && !Strings.isNullOrEmpty(attribute.getValue())) { assertion.setIssueInstant(new DateTime(attribute.getValue(), ISOChronology.getInstanceUTC())); } else if (attribute.getLocalName().equals(Assertion.ID_ATTRIB_NAME)) { assertion.setID(attribute.getValue()); attribute.getOwnerElement().setIdAttributeNode(attribute, true); } else { super.processAttribute(samlObject, attribute); } } }
/** * Create a SAML 2 assertion * * @return a SAML 2 assertion */ @SuppressWarnings("unchecked") public static Assertion createAssertion() { if (assertionBuilder == null) { assertionBuilder = (SAMLObjectBuilder<Assertion>) builderFactory.getBuilder(Assertion.DEFAULT_ELEMENT_NAME); if (assertionBuilder == null) { throw new IllegalStateException( "OpenSaml engine not initialized. Please make sure to initialize the OpenSaml engine " + "prior using it" ); } } Assertion assertion = assertionBuilder.buildObject(Assertion.DEFAULT_ELEMENT_NAME, Assertion.TYPE_NAME); assertion.setID(IDGenerator.generateID("_")); assertion.setVersion(SAMLVersion.VERSION_20); assertion.setIssueInstant(new DateTime()); return assertion; }
assertion.setID(idGenerator.generateIdentifier()); assertion.setIssueInstant(new DateTime()); assertion.setVersion(SAMLVersion.VERSION_20);
Assertion samlAssertion = new AssertionBuilder().buildObject(); samlAssertion.setID(SAMLSSOUtil.createID()); samlAssertion.setVersion(SAMLVersion.VERSION_20); samlAssertion.setIssuer(OpenSAML3Util.getIssuer("carbon.super")); samlAssertion.setIssueInstant(currentTime);
Assertion samlAssertion = new AssertionBuilder().buildObject(); samlAssertion.setID(SAMLSSOUtil.createID()); samlAssertion.setVersion(SAMLVersion.VERSION_20); samlAssertion.setIssuer(OpenSAML3Util.getIssuer("carbon.super")); samlAssertion.setIssueInstant(currentTime);
protected org.opensaml.saml.saml2.core.Assertion internalToXml(Assertion request) { org.opensaml.saml.saml2.core.Assertion a = buildSAMLObject(org.opensaml.saml.saml2.core.Assertion .class); a.setVersion(SAMLVersion.VERSION_20); a.setIssueInstant(request.getIssueInstant()); a.setID(request.getId());