/** * Validates that the statement has a subject. * * @param subjectStatement statement to validate * * @throws ValidationException thrown if the statement does not have a subject */ protected void validateSubject(SubjectStatementType subjectStatement) throws ValidationException { if (subjectStatement.getSubject() == null) { throw new ValidationException("No Subject present"); } } }
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentSAMLObject, XMLObject childSAMLObject) throws UnmarshallingException { SubjectStatement statement = (SubjectStatement) parentSAMLObject; if (childSAMLObject instanceof Subject) { statement.setSubject((Subject) childSAMLObject); } else { super.processChildElement(parentSAMLObject, childSAMLObject); } }
/** * 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; }
subjectStatements.addAll(saml1.getAuthorizationDecisionStatements()); for (SubjectStatement subjectStatement : subjectStatements) { Subject subject = subjectStatement.getSubject(); if (subject != null) { SubjectConfirmation confirmation = subject.getSubjectConfirmation();
subjectStatements.addAll(saml1.getAuthorizationDecisionStatements()); for (SubjectStatement subjectStatement : subjectStatements) { Subject subject = subjectStatement.getSubject(); if (subject != null) { SubjectConfirmation confirmation = subject.getSubjectConfirmation();