/** {@inheritDoc} */ protected void processElementContent(XMLObject samlObject, String elementContent) { ConfirmationMethod confirmationMethod = (ConfirmationMethod) samlObject; confirmationMethod.setConfirmationMethod(elementContent); } }
/** {@inheritDoc} */ protected void marshallElementContent(XMLObject samlObject, Element domElement) throws MarshallingException { ConfirmationMethod confirmationMethod = (ConfirmationMethod) samlObject; XMLHelper.appendTextContent(domElement, confirmationMethod.getConfirmationMethod()); } }
/** * Creates the subject confirmation method. * Relevant XML element would look like as follows, * <pre> <saml:ConfirmationMethod> * urn:oasis:names:tc:SAML:1.0:cm:holder-of-key * </saml:ConfirmationMethod></pre> * @param confirmationMethod Name of the actual confirmation method. Could be * holder-of-key - "urn:oasis:names:tc:SAML:1.0:cm:holder-of-key" * sender-vouches - "urn:oasis:names:tc:SAML:1.0:cm:sender-vouches" * bearer - TODO * @return Returns the opensaml representation of the ConfirmationMethod. * @throws TrustException If unable to find appropriate XMLObject builder for confirmation QName. */ public static ConfirmationMethod createSubjectConfirmationMethod(final String confirmationMethod) throws TrustException { ConfirmationMethod confirmationMethodObject = (ConfirmationMethod)CommonUtil.buildXMLObject(ConfirmationMethod.DEFAULT_ELEMENT_NAME); confirmationMethodObject.setConfirmationMethod(confirmationMethod); return confirmationMethodObject; }
/** * 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; }
private Subject newSubject(final String identifier) { final SubjectConfirmation confirmation = newSamlObject(SubjectConfirmation.class); final ConfirmationMethod method = newSamlObject(ConfirmationMethod.class); method.setConfirmationMethod(CONFIRMATION_METHOD); confirmation.getConfirmationMethods().add(method); final NameIdentifier nameIdentifier = newSamlObject(NameIdentifier.class); nameIdentifier.setNameIdentifier(identifier); final Subject subject = newSamlObject(Subject.class); subject.setNameIdentifier(nameIdentifier); subject.setSubjectConfirmation(confirmation); return subject; }
if (data instanceof ConfirmationMethod) { ConfirmationMethod method = (ConfirmationMethod) data; methods.add(method.getConfirmationMethod()); methods.add(confirmationMethod.getConfirmationMethod());
(SubjectConfirmation) buildXMLObject(SubjectConfirmation.DEFAULT_ELEMENT_NAME); ConfirmationMethod confMethod = (ConfirmationMethod) buildXMLObject(ConfirmationMethod.DEFAULT_ELEMENT_NAME); confMethod.setConfirmationMethod(CONF_KEY); subjectConf.getConfirmationMethods().add(confMethod); subject.setSubjectConfirmation(subjectConf);
if (data instanceof ConfirmationMethod) { ConfirmationMethod method = (ConfirmationMethod) data; methods.add(method.getConfirmationMethod()); methods.add(confirmationMethod.getConfirmationMethod());
(SubjectConfirmation) buildXMLObject(SubjectConfirmation.DEFAULT_ELEMENT_NAME); ConfirmationMethod confMethod = (ConfirmationMethod) buildXMLObject(ConfirmationMethod.DEFAULT_ELEMENT_NAME); confMethod.setConfirmationMethod(CONF_KEY); subjectConf.getConfirmationMethods().add(confMethod); subject.setSubjectConfirmation(subjectConf);
List<ConfirmationMethod> confirmationMethods = subjectConfirmation.getConfirmationMethods(); for (ConfirmationMethod confirmationMethod : confirmationMethods) { if (OAuthConstants.OAUTH_SAML1_BEARER_METHOD.equals(confirmationMethod.getConfirmationMethod())) { bearerFound = true;
confirmationMethod.setConfirmationMethod(confirmationMethodStr); subjectConfirmation.getConfirmationMethods().add(confirmationMethod); if (subjectBean.getKeyInfo() != null) {
List<ConfirmationMethod> confirmationMethods = subjectConfirmation.getConfirmationMethods(); for (ConfirmationMethod confirmationMethod : confirmationMethods) { if (OAuthConstants.OAUTH_SAML1_BEARER_METHOD.equals(confirmationMethod.getConfirmationMethod())) { bearerFound = true;
confirmationMethod.setConfirmationMethod(confirmationMethodStr); subjectConfirmation.getConfirmationMethods().add(confirmationMethod); if (subjectBean.getKeyInfo() != null) {