Example #1
0
  private void processIdPMetadata(SPType spConfiguration) {
    IDPSSODescriptorType idpssoDescriptorType = null;

    if (isNotNull(spConfiguration.getIdpMetadataFile())) {
      idpssoDescriptorType = getIdpMetadataFromFile(spConfiguration);
    } else {
      idpssoDescriptorType = getIdpMetadataFromProvider(spConfiguration);
    }

    if (idpssoDescriptorType != null) {
      List<EndpointType> endpoints = idpssoDescriptorType.getSingleSignOnService();
      for (EndpointType endpoint : endpoints) {
        String endpointBinding = endpoint.getBinding().toString();
        if (endpointBinding.contains("HTTP-POST")) {
          endpointBinding = "POST";
        } else if (endpointBinding.contains("HTTP-Redirect")) {
          endpointBinding = "REDIRECT";
        }
        if (spConfiguration.getBindingType().equals(endpointBinding)) {
          spConfiguration.setIdentityURL(endpoint.getLocation().toString());
          break;
        }
      }

      this.idpMetadata = idpssoDescriptorType;
    }
  }
  private void writeEndpointType(EndpointType endpoint) throws ProcessingException {
    StaxUtil.writeAttribute(
        writer, JBossSAMLConstants.BINDING.get(), endpoint.getBinding().toString());
    StaxUtil.writeAttribute(
        writer, JBossSAMLConstants.LOCATION.get(), endpoint.getLocation().toString());

    URI responseLocation = endpoint.getResponseLocation();
    if (responseLocation != null) {
      StaxUtil.writeAttribute(
          writer, JBossSAMLConstants.RESPONSE_LOCATION.get(), responseLocation.toString());
    }
  }