/** {@inheritDoc} */ @Override protected boolean doPreInvoke(@Nonnull final MessageContext messageContext) throws MessageHandlerException { if (!super.doPreInvoke(messageContext)) { return false; } channelBindingsContext = channelBindingsContextLookupStrategy.apply(messageContext); if (channelBindingsContext == null || channelBindingsContext.getChannelBindings().isEmpty()) { log.debug("{} No ChannelBindings to add, nothing to do", getLogPrefix()); return false; } return true; }
/** {@inheritDoc} */ @Override protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) { if (!super.doPreExecute(profileRequestContext)) { return false; } channelBindingsContext1 = channelBindingsLookupStrategy1.apply(profileRequestContext); channelBindingsContext2 = channelBindingsLookupStrategy2.apply(profileRequestContext); if (channelBindingsContext1 != null && channelBindingsContext1.getChannelBindings().isEmpty()) { channelBindingsContext1 = null; } if (channelBindingsContext2 != null && channelBindingsContext2.getChannelBindings().isEmpty()) { channelBindingsContext2 = null; } if (channelBindingsContext1 == null && channelBindingsContext2 == null) { log.debug("{} No channel bindings found to verify, nothing to do", getLogPrefix()); return false; } return true; }
/** {@inheritDoc} */ @Override protected void doInvoke(@Nonnull final MessageContext messageContext) throws MessageHandlerException { final Collection<ChannelBindings> channelBindings = new ArrayList<>(); final List<XMLObject> headers = SOAPMessagingSupport.getHeaderBlock(messageContext, ChannelBindings.DEFAULT_ELEMENT_NAME, null, finalDestination); for (final XMLObject header : headers) { if (header instanceof ChannelBindings) { if (null == ((ActorBearing) header).getSOAP11Actor() || nextDestination) { channelBindings.add((ChannelBindings) header); } } } if (channelBindings.isEmpty()) { log.debug("{} No ChannelBindings header blocks found", getLogPrefix()); } else { log.debug("{} {} ChannelBindings header block(s) found", getLogPrefix(), channelBindings.size()); messageContext.getSubcontext(SOAP11Context.class).getSubcontext(ChannelBindingsContext.class, true).getChannelBindings().addAll(channelBindings); } }
/** {@inheritDoc} */ @Override protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext) { if (!super.doPreExecute(profileRequestContext)) { return false; } channelBindingsContext = channelBindingsContextLookupStrategy.apply(profileRequestContext); if (channelBindingsContext == null || channelBindingsContext.getChannelBindings().isEmpty()) { log.debug("{} No ChannelBindings to add, nothing to do", getLogPrefix()); return false; } log.debug("{} Attempting to add ChannelBindings to every Assertion in Response", getLogPrefix()); response = responseLookupStrategy.apply(profileRequestContext); if (response == null) { log.debug("{} No SAML response located in current profile request context", getLogPrefix()); ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MSG_CTX); return false; } else if (response.getAssertions().isEmpty()) { log.debug("{} No assertions in response message, nothing to do", getLogPrefix()); return false; } return true; }
for (final ChannelBindings cb1 : channelBindingsContext1.getChannelBindings()) { for (final ChannelBindings cb2 : channelBindingsContext2.getChannelBindings()) { if (Objects.equals(cb1.getType(), cb2.getType())) { final String cb1Data = StringSupport.trimOrNull(cb1.getValue()); cbCtx.getChannelBindings().add(matched); } else { log.error("{} Unable to create ChannelBindingContext to store result", getLogPrefix());
messageContext.getSubcontext(ChannelBindingsContext.class, true).getChannelBindings(); for (final XMLObject cb : bindings) { if (cb instanceof ChannelBindings) {
/** {@inheritDoc} */ @Override protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) { final SAMLObjectBuilder<ChannelBindings> cbBuilder = (SAMLObjectBuilder<ChannelBindings>) XMLObjectProviderRegistrySupport.getBuilderFactory().<ChannelBindings>getBuilderOrThrow( ChannelBindings.DEFAULT_ELEMENT_NAME); for (final Assertion assertion : response.getAssertions()) { final Advice advice = SAML2ActionSupport.addAdviceToAssertion(this, assertion); for (final ChannelBindings cb : channelBindingsContext.getChannelBindings()) { final ChannelBindings newCB = cbBuilder.buildObject(); newCB.setType(cb.getType()); advice.getChildren().add(newCB); } } log.debug("{} Added ChannelBindings indicator(s) to Advice", getLogPrefix()); }
/** {@inheritDoc} */ @Override protected void doInvoke(@Nonnull final MessageContext messageContext) throws MessageHandlerException { final SAMLObjectBuilder<ChannelBindings> cbBuilder = (SAMLObjectBuilder<ChannelBindings>) XMLObjectProviderRegistrySupport.getBuilderFactory().<ChannelBindings>getBuilderOrThrow( ChannelBindings.DEFAULT_ELEMENT_NAME); for (final ChannelBindings cb : channelBindingsContext.getChannelBindings()) { final ChannelBindings header = cbBuilder.buildObject(); header.setType(cb.getType()); SOAPSupport.addSOAP11MustUnderstandAttribute(header, true); SOAPSupport.addSOAP11ActorAttribute(header, ActorBearing.SOAP11_ACTOR_NEXT); try { SOAPMessagingSupport.addHeaderBlock(messageContext, header); } catch (final Exception e) { throw new MessageHandlerException(e); } } }