/** * Validates that the subject has either a name identifier or subject confirmation * * @param subject subject to validate * * @throws ValidationException thrown if the subject has neither a name identifier or subject confirmation */ protected void validateNameIdentifierSubjectConfirmation(Subject subject) throws ValidationException { if (subject.getNameIdentifier() == null && subject.getSubjectConfirmation() == null) { throw new ValidationException("Either a NameIdentifier or SubjectConfirmation should be 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; }
Subject subject = subjectStatement.getSubject(); if (subject != null) { SubjectConfirmation confirmation = subject.getSubjectConfirmation(); if (confirmation != null) { XMLObject data = confirmation.getSubjectConfirmationData();
Subject subject = subjectStatement.getSubject(); if (subject != null) { SubjectConfirmation confirmation = subject.getSubjectConfirmation(); if (confirmation != null) { XMLObject data = confirmation.getSubjectConfirmationData();
SubjectConfirmation subjectConfirmation = subject.getSubjectConfirmation(); List<ConfirmationMethod> confirmationMethods = subjectConfirmation.getConfirmationMethods(); for (ConfirmationMethod confirmationMethod : confirmationMethods) { log.debug("Cannot find Method attribute in SubjectConfirmation " + subject.getSubjectConfirmation()); XMLObject confirmationData = subject.getSubjectConfirmation().getSubjectConfirmationData(); if (confirmationData == null) { log.warn("Subject confirmation data is missing.");
SubjectConfirmation subjectConfirmation = subject.getSubjectConfirmation(); List<ConfirmationMethod> confirmationMethods = subjectConfirmation.getConfirmationMethods(); for (ConfirmationMethod confirmationMethod : confirmationMethods) { log.debug("Cannot find Method attribute in SubjectConfirmation " + subject.getSubjectConfirmation()); XMLObject confirmationData = subject.getSubjectConfirmation().getSubjectConfirmationData(); if (confirmationData == null) { log.warn("Subject confirmation data is missing.");
Element sub = samlSubject.getSubjectConfirmation().getDOM(); Element keyInfoElement = WSSecurityUtil.getDirectChildElement(sub, "KeyInfo", WSConstants.SIG_NS);
Element sub = samlSubject.getSubjectConfirmation().getDOM(); Element keyInfoElement = WSSecurityUtil.getDirectChildElement(sub, "KeyInfo", WSConstants.SIG_NS);