/** {@inheritDoc} */ protected void marshallAttributes(XMLObject samlObject, Element domElement) throws MarshallingException { SubjectConfirmation subjectConfirmation = (SubjectConfirmation) samlObject; if (subjectConfirmation.getMethod() != null) { domElement.setAttributeNS(null, SubjectConfirmation.METHOD_ATTRIB_NAME, subjectConfirmation.getMethod()); } } }
private boolean updateBearerFound(SubjectConfirmation subjectConfirmation, boolean bearerFound) throws IdentityOAuth2Exception { if (subjectConfirmation.getMethod() != null) { if (subjectConfirmation.getMethod().equals(OAuthConstants.OAUTH_SAML2_BEARER_METHOD)) { bearerFound = true; } } else { if (log.isDebugEnabled()){ log.debug("Cannot find Method attribute in SubjectConfirmation " + subjectConfirmation.toString()); } throw new IdentityOAuth2Exception("Cannot find Method attribute in SubjectConfirmation"); } return bearerFound; }
/** * Get the subject confirmation method of a SAML 2.0 assertion * * @param assertion SAML 2.0 assertion * @return Subject Confirmation method */ public static String getSAML2SubjectConfirmationMethod(Assertion assertion) { String subjectConfirmationMethod = RahasConstants.SAML20_SUBJECT_CONFIRMATION_HOK; List<SubjectConfirmation> subjectConfirmations = assertion.getSubject().getSubjectConfirmations(); if (subjectConfirmations.size() > 0) { subjectConfirmationMethod = subjectConfirmations.get(0).getMethod(); } return subjectConfirmationMethod; }
/** * Checks that Method is present. * * @param subjectConfirmation * @throws ValidationException */ protected void validateMethod(SubjectConfirmation subjectConfirmation) throws ValidationException { if (DatatypeHelper.isEmpty(subjectConfirmation.getMethod())) { throw new ValidationException("Method required"); } } }
/** * Method getConfirmationMethods returns the confirmationMethods of this * AssertionWrapper model. * * @return the confirmationMethods of this AssertionWrapper model. */ public List<String> getConfirmationMethods() { List<String> methods = new ArrayList<String>(); if (saml2 != null) { org.opensaml.saml2.core.Subject subject = saml2.getSubject(); List<org.opensaml.saml2.core.SubjectConfirmation> confirmations = subject.getSubjectConfirmations(); for (org.opensaml.saml2.core.SubjectConfirmation confirmation : confirmations) { methods.add(confirmation.getMethod()); } } return methods; }
public SubjectConfirmation(Authentication authentication){ SAMLCredential credential = (SAMLCredential) authentication.getCredentials(); Subject subject = credential.getAuthenticationAssertion().getSubject(); List<org.opensaml.saml2.core.SubjectConfirmation> subjectConfirmations = subject.getSubjectConfirmations(); org.opensaml.saml2.core.SubjectConfirmation subjectConfirmation = subjectConfirmations.get(0); SubjectConfirmationData subjectConfirmationData = subjectConfirmation.getSubjectConfirmationData(); method = subjectConfirmation.getMethod(); inResponseTo = subjectConfirmationData.getInResponseTo(); notOnOrAfter = subjectConfirmationData.getNotOnOrAfter(); recipient = subjectConfirmationData.getRecipient(); }
subject.getSubjectConfirmations(); for (org.opensaml.saml2.core.SubjectConfirmation confirmation : confirmations) { methods.add(confirmation.getMethod());
subject.getSubjectConfirmations(); for (org.opensaml.saml2.core.SubjectConfirmation confirmation : confirmations) { methods.add(confirmation.getMethod());
if (SubjectConfirmation.METHOD_BEARER.equals(confirmation.getMethod())) {
if (SubjectConfirmation.METHOD_HOLDER_OF_KEY.equals(confirmation.getMethod())) {
boolean confirmed = false; for (SubjectConfirmation confirmation : subject.getSubjectConfirmations()) { if (BEARER_CONFIRMATION.equals(confirmation.getMethod())) {