assertThat(acs.get(0).getLocation()) .isEqualTo("http://" + spHostname + ':' + rule.httpPort() + "/saml/acs/post"); assertThat(acs.get(0).getBinding()).isEqualTo(SAMLConstants.SAML2_POST_BINDING_URI); assertThat(acs.get(1).getLocation()) .isEqualTo("http://" + spHostname + ':' + rule.httpPort() + "/saml/acs/redirect"); assertThat(acs.get(1).getBinding()).isEqualTo(SAMLConstants.SAML2_REDIRECT_BINDING_URI);
/** * Gets assertion consumer service. * * @param binding the binding * @return the assertion consumer service */ public AssertionConsumerService getAssertionConsumerService(final String binding) { return getAssertionConsumerServices().stream().filter(acs -> acs.getBinding().equals(binding)).findFirst().orElse(null); }
/** Does the {@link EntityDescriptor} have a {@link MetadataServiceRegistry#PROXY_BINDING} acs. * @param entity what to look at * @return Whether is is authorized to proxy */ private boolean isAuthorizedToProxy(@Nonnull final EntityDescriptor entity) { final SPSSODescriptor descriptor = entity.getSPSSODescriptor(AbstractProtocolConfiguration.PROTOCOL_URI); if (descriptor != null) { for (final AssertionConsumerService acs : descriptor.getAssertionConsumerServices()) { if (PROXY_BINDING.equals(acs.getBinding())) { return true; } } } return false; }
/** * Determine profile binding. * * @param authenticationContext the authentication context * @param assertion the assertion * @return the string */ protected String determineProfileBinding(final Pair<AuthnRequest, MessageContext> authenticationContext, final Assertion assertion) { val authnRequest = authenticationContext.getKey(); val pair = getRegisteredServiceAndFacade(authnRequest); val facade = pair.getValue(); val binding = StringUtils.defaultIfBlank(authnRequest.getProtocolBinding(), SAMLConstants.SAML2_POST_BINDING_URI); LOGGER.debug("Determined authentication request binding is [{}], issued by [{}]", binding, authnRequest.getIssuer().getValue()); val entityId = facade.getEntityId(); LOGGER.debug("Checking metadata for [{}] to see if binding [{}] is supported", entityId, binding); @NonNull val svc = facade.getAssertionConsumerService(binding); LOGGER.debug("Binding [{}] is supported by [{}]", svc.getBinding(), entityId); return binding; } }
acs.setBinding(foundAcs.getBinding()); acs.setLocation(foundAcs.getLocation()); acs.setResponseLocation(foundAcs.getResponseLocation()); if (StringUtils.isBlank(acs.getBinding())) { throw new SamlException("AssertionConsumerService has no protocol binding defined");
request.setAssertionConsumerServiceURL(assertionConsumerService.getLocation()); request.setProtocolBinding(assertionConsumerService.getBinding());