/** * Test that the provided assertion has some statements in * @param assertion * @throws ValidationException */ protected void validateStatements(Assertion assertion) throws ValidationException { List <Statement> list = assertion.getStatements(); if (list == null || list.size() == 0) { throw new ValidationException("No Statements present"); } } }
/** * Get subject confirmation method of the given SAML 1.1 Assertion. * This is used in rampart-core. * @param assertion SAML 1.1 Assertion * @return subject confirmation method */ public static String getSAML11SubjectConfirmationMethod(Assertion assertion) { String subjectConfirmationMethod = RahasConstants.SAML11_SUBJECT_CONFIRMATION_HOK; // iterate the statements and get the subject confirmation method. List<Statement> statements = assertion.getStatements(); // TODO check whether there is an efficient method of doing this if (!statements.isEmpty()) { SubjectStatement subjectStatement = (SubjectStatement) statements.get(0); Subject subject = subjectStatement.getSubject(); if (subject != null) { SubjectConfirmation subjectConfirmation = subject.getSubjectConfirmation(); if (subjectConfirmation != null) { List<ConfirmationMethod> confirmationMethods = subjectConfirmation.getConfirmationMethods(); if (!confirmationMethods.isEmpty()) { subjectConfirmationMethod = confirmationMethods.get(0).getConfirmationMethod(); } } } } return subjectConfirmationMethod; }
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) throws UnmarshallingException { Assertion assertion = (Assertion) parentSAMLObject; if (childSAMLObject instanceof Signature) { assertion.setSignature((Signature) childSAMLObject); } else if (childSAMLObject instanceof Conditions) { assertion.setConditions((Conditions) childSAMLObject); } else if (childSAMLObject instanceof Advice) { assertion.setAdvice((Advice) childSAMLObject); } else if (childSAMLObject instanceof Statement) { assertion.getStatements().add((Statement) childSAMLObject); } else { super.processChildElement(parentSAMLObject, childSAMLObject); } }
assertion.getStatements().addAll(statements); assertion.setID(UIDGenerator.generateUID()); assertion.setIssueInstant(new DateTime());
for (org.opensaml.saml1.core.Statement stmt : assertion.getSaml1().getStatements()) { if (stmt instanceof org.opensaml.saml1.core.AttributeStatement) { org.opensaml.saml1.core.AttributeStatement attrStmt =
for (org.opensaml.saml1.core.Statement stmt : assertion.getSaml1().getStatements()) { if (stmt instanceof org.opensaml.saml1.core.AttributeStatement) { org.opensaml.saml1.core.AttributeStatement attrStmt =
for (org.opensaml.saml1.core.Statement stmt : assertion.getStatements()) { org.opensaml.saml1.core.Subject samlSubject = null; if (stmt instanceof org.opensaml.saml1.core.AttributeStatement) {
for (org.opensaml.saml1.core.Statement stmt : assertion.getStatements()) { org.opensaml.saml1.core.Subject samlSubject = null; if (stmt instanceof org.opensaml.saml1.core.AttributeStatement) {