/** * Test that the ID is present * @param assertion * @throws ValidationException */ protected void validateId(Assertion assertion) throws ValidationException { if (DatatypeHelper.isEmpty(assertion.getID())) { throw new ValidationException("ID not present"); } }
/** {@inheritDoc} */ protected void marshallAttributes(XMLObject samlElement, Element domElement) throws MarshallingException { Assertion assertion = (Assertion) samlElement; if (assertion.getID() != null) { domElement.setAttributeNS(null, Assertion.ID_ATTRIB_NAME, assertion.getID()); if (assertion.getMinorVersion() != 0) { domElement.setIdAttributeNS(null, Assertion.ID_ATTRIB_NAME, true); } } if (assertion.getIssuer() != null) { domElement.setAttributeNS(null, Assertion.ISSUER_ATTRIB_NAME, assertion.getIssuer()); } if (assertion.getIssueInstant() != null) { String date = ISODateTimeFormat.dateTime().print(assertion.getIssueInstant()); domElement.setAttributeNS(null, Assertion.ISSUEINSTANT_ATTRIB_NAME, date); } domElement.setAttributeNS(null, Assertion.MAJORVERSION_ATTRIB_NAME, "1"); if (assertion.getMinorVersion() == 0) { domElement.setAttributeNS(null, Assertion.MINORVERSION_ATTRIB_NAME, "0"); } else { domElement.setAttributeNS(null, Assertion.MINORVERSION_ATTRIB_NAME, "1"); } } }
/** * Method getId returns the id of this AssertionWrapper object. * * @return the id (type String) of this AssertionWrapper object. */ public String getId() { String id = null; if (saml2 != null) { id = saml2.getID(); } else if (saml1 != null) { id = saml1.getID(); } else { LOG.error("AssertionWrapper: unable to return ID - no saml assertion object"); } if (id == null || id.length() == 0) { LOG.error("AssertionWrapper: ID was null, seeting a new ID value"); id = "_" + UUIDGenerator.getUUID(); if (saml2 != null) { saml2.setID(id); } else if (saml1 != null) { saml1.setID(id); } } return id; }
/** * Method getId returns the id of this AssertionWrapper object. * * @return the id (type String) of this AssertionWrapper object. */ public String getId() { String id = null; if (saml2 != null) { id = saml2.getID(); } else if (saml1 != null) { id = saml1.getID(); } else { LOG.error("AssertionWrapper: unable to return ID - no saml assertion object"); } if (id == null || id.length() == 0) { LOG.error("AssertionWrapper: ID was null, seeting a new ID value"); id = "_" + UUIDGenerator.getUUID(); if (saml2 != null) { saml2.setID(id); } else if (saml1 != null) { saml1.setID(id); } } return id; }
/** {@inheritDoc} */ public XMLObject unmarshall(Element domElement) throws UnmarshallingException { // After regular unmarshalling, check the minor version and set ID-ness if not SAML 1.0 Assertion assertion = (Assertion) super.unmarshall(domElement); if (assertion.getMinorVersion() != 0 && !DatatypeHelper.isEmpty(assertion.getID())) { domElement.setIdAttributeNS(null, Assertion.ID_ATTRIB_NAME, true); } return assertion; }
@Override protected void processSAMLAssertion() { this.setAssertionId(assertion.getID()); //Read the validity period from the 'Conditions' element, else read it from SC Data if (assertion.getConditions() != null) { Conditions conditions = assertion.getConditions(); if (conditions.getNotBefore() != null) { this.setDateNotBefore(conditions.getNotBefore().toDate()); } if (conditions.getNotOnOrAfter() != null) { this.setDateNotOnOrAfter(conditions.getNotOnOrAfter().toDate()); } } }
) throws WSSecurityException { byte[] key = getSecretKeyFromCallbackHandler(assertion.getID(), data.getCallbackHandler()); if (key != null && key.length > 0) { return new SAMLKeyInfo(key);
) throws WSSecurityException { byte[] key = getSecretKeyFromCallbackHandler(assertion.getID(), data.getCallbackHandler()); if (key != null && key.length > 0) { return new SAMLKeyInfo(key);