Class OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter

java.lang.Object
org.springframework.security.saml2.provider.service.registration.OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter
All Implemented Interfaces:
org.springframework.http.converter.HttpMessageConverter<RelyingPartyRegistration.Builder>

public class OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter extends Object implements org.springframework.http.converter.HttpMessageConverter<RelyingPartyRegistration.Builder>
An HttpMessageConverter that takes an IDPSSODescriptor in an HTTP response and converts it into a RelyingPartyRegistration.Builder. The primary use case for this is constructing a RelyingPartyRegistration for inclusion in a RelyingPartyRegistrationRepository. To do so, you can include an instance of this converter in a RestOperations like so:
                RestOperations rest = new RestTemplate(Collections.singletonList(
                        new RelyingPartyRegistrationsBuilderHttpMessageConverter()));
                RelyingPartyRegistration.Builder builder = rest.getForObject
                                ("https://idp.example.org/metadata", RelyingPartyRegistration.Builder.class);
                RelyingPartyRegistration registration = builder.registrationId("registration-id").build();
 
Note that this will only configure the asserting party (IDP) half of the RelyingPartyRegistration, meaning where and how to send AuthnRequests, how to verify Assertions, etc. To further configure the RelyingPartyRegistration with relying party (SP) information, you may invoke the appropriate methods on the builder.
Since:
5.4
  • Constructor Details

  • Method Details

    • canRead

      public boolean canRead(Class<?> clazz, org.springframework.http.MediaType mediaType)
      Specified by:
      canRead in interface org.springframework.http.converter.HttpMessageConverter<RelyingPartyRegistration.Builder>
    • canWrite

      public boolean canWrite(Class<?> clazz, org.springframework.http.MediaType mediaType)
      Specified by:
      canWrite in interface org.springframework.http.converter.HttpMessageConverter<RelyingPartyRegistration.Builder>
    • getSupportedMediaTypes

      public List<org.springframework.http.MediaType> getSupportedMediaTypes()
      Specified by:
      getSupportedMediaTypes in interface org.springframework.http.converter.HttpMessageConverter<RelyingPartyRegistration.Builder>
    • read

      public RelyingPartyRegistration.Builder read(Class<? extends RelyingPartyRegistration.Builder> clazz, org.springframework.http.HttpInputMessage inputMessage) throws IOException, org.springframework.http.converter.HttpMessageNotReadableException
      Specified by:
      read in interface org.springframework.http.converter.HttpMessageConverter<RelyingPartyRegistration.Builder>
      Throws:
      IOException
      org.springframework.http.converter.HttpMessageNotReadableException
    • write

      public void write(RelyingPartyRegistration.Builder builder, org.springframework.http.MediaType contentType, org.springframework.http.HttpOutputMessage outputMessage) throws org.springframework.http.converter.HttpMessageNotWritableException
      Specified by:
      write in interface org.springframework.http.converter.HttpMessageConverter<RelyingPartyRegistration.Builder>
      Throws:
      org.springframework.http.converter.HttpMessageNotWritableException