Skip to main content
code formatting
Source Link
EricSchaefer
  • 26.6k
  • 22
  • 75
  • 106

In reference to this SO question Add request parameter to SAML request using Spring Security SAML

I am wanting to replace the default HTTPRedirectDeflateBinding bean with my own that has a custom HTTPRedirectDeflateEncoder to add query params to my SAML request.

I'm trying to achieve this with the Spring Boot @Bean auto-configuration annotation and being new to the Java environment I can't seem to get it working right. I can see that my bean is registering on startup but the outbound HTTP request is not being intercepted by it and it appears the original redirectBinding still is.

Here is my bean I added into my Configuration class:

@Bean(name="redirectBinding") @Primary public HTTPRedirectDeflateBinding HTTPRedirectDeflateBinding() { return new HTTPRedirectDeflateBinding(null, new My_SAML_HttpRedirectDeflateEncoder()); } 
@Bean(name="redirectBinding") @Primary public HTTPRedirectDeflateBinding HTTPRedirectDeflateBinding() { return new HTTPRedirectDeflateBinding(null, new My_SAML_HttpRedirectDeflateEncoder()); } 

Here is my encoder I'm trying to pass into the redirect binding

public class My_SAML_HttpRedirectDeflateEncoder extends HTTPRedirectDeflateEncoder{ @Override protected String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message) throws MessageEncodingException { URLBuilder urlBuilder = new URLBuilder(endpointURL); List<Pair<String, String>> queryParams = urlBuilder.getQueryParams(); if (messagesContext.getOutboundSAMLMessage() instanceof RequestAbstractType) { queryParams.add(new Pair<String, String>("service", "myService")); queryParams.add(new Pair<String, String>("serviceType", "dev")); } return urlBuilder.buildURL(); } 

}

public class My_SAML_HttpRedirectDeflateEncoder extends HTTPRedirectDeflateEncoder { @Override protected String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message) throws MessageEncodingException { URLBuilder urlBuilder = new URLBuilder(endpointURL); List<Pair<String, String>> queryParams = urlBuilder.getQueryParams(); if (messagesContext.getOutboundSAMLMessage() instanceof RequestAbstractType) { queryParams.add(new Pair<String, String>("service", "myService")); queryParams.add(new Pair<String, String>("serviceType", "dev")); } return urlBuilder.buildURL(); } } 

I also attempted the solution proposed from this SO response Spring Boot Adding Http Request Interceptors Similar results, my HandlerInterceptor bean was registered but nothing is being intercepted. I feel like I'm missing a small detail. Any help would be appreciated.

In reference to this SO question Add request parameter to SAML request using Spring Security SAML

I am wanting to replace the default HTTPRedirectDeflateBinding bean with my own that has a custom HTTPRedirectDeflateEncoder to add query params to my SAML request.

I'm trying to achieve this with the Spring Boot @Bean auto-configuration annotation and being new to the Java environment I can't seem to get it working right. I can see that my bean is registering on startup but the outbound HTTP request is not being intercepted by it and it appears the original redirectBinding still is.

Here is my bean I added into my Configuration class:

@Bean(name="redirectBinding") @Primary public HTTPRedirectDeflateBinding HTTPRedirectDeflateBinding() { return new HTTPRedirectDeflateBinding(null, new My_SAML_HttpRedirectDeflateEncoder()); } 

Here is my encoder I'm trying to pass into the redirect binding

public class My_SAML_HttpRedirectDeflateEncoder extends HTTPRedirectDeflateEncoder{ @Override protected String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message) throws MessageEncodingException { URLBuilder urlBuilder = new URLBuilder(endpointURL); List<Pair<String, String>> queryParams = urlBuilder.getQueryParams(); if (messagesContext.getOutboundSAMLMessage() instanceof RequestAbstractType) { queryParams.add(new Pair<String, String>("service", "myService")); queryParams.add(new Pair<String, String>("serviceType", "dev")); } return urlBuilder.buildURL(); } 

}

I also attempted the solution proposed from this SO response Spring Boot Adding Http Request Interceptors Similar results, my HandlerInterceptor bean was registered but nothing is being intercepted. I feel like I'm missing a small detail. Any help would be appreciated.

In reference to this SO question Add request parameter to SAML request using Spring Security SAML

I am wanting to replace the default HTTPRedirectDeflateBinding bean with my own that has a custom HTTPRedirectDeflateEncoder to add query params to my SAML request.

I'm trying to achieve this with the Spring Boot @Bean auto-configuration annotation and being new to the Java environment I can't seem to get it working right. I can see that my bean is registering on startup but the outbound HTTP request is not being intercepted by it and it appears the original redirectBinding still is.

Here is my bean I added into my Configuration class:

@Bean(name="redirectBinding") @Primary public HTTPRedirectDeflateBinding HTTPRedirectDeflateBinding() { return new HTTPRedirectDeflateBinding(null, new My_SAML_HttpRedirectDeflateEncoder()); } 

Here is my encoder I'm trying to pass into the redirect binding

public class My_SAML_HttpRedirectDeflateEncoder extends HTTPRedirectDeflateEncoder { @Override protected String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message) throws MessageEncodingException { URLBuilder urlBuilder = new URLBuilder(endpointURL); List<Pair<String, String>> queryParams = urlBuilder.getQueryParams(); if (messagesContext.getOutboundSAMLMessage() instanceof RequestAbstractType) { queryParams.add(new Pair<String, String>("service", "myService")); queryParams.add(new Pair<String, String>("serviceType", "dev")); } return urlBuilder.buildURL(); } } 

I also attempted the solution proposed from this SO response Spring Boot Adding Http Request Interceptors Similar results, my HandlerInterceptor bean was registered but nothing is being intercepted. I feel like I'm missing a small detail. Any help would be appreciated.

Notice removed Draw attention by CommunityBot
Bounty Ended with no winning answer by CommunityBot
Notice added Draw attention by Fratt
Bounty Started worth 100 reputation by Fratt
added 19 characters in body
Source Link
Fratt
  • 249
  • 4
  • 14

In reference to this SO question Add request parameter to SAML request using Spring Security SAML

I am wanting to replace the default HTTPRedirectDeflateBinding bean with my own that has a custom HTTPRedirectDeflateEncoder to add query params to my SAML request.

I'm trying to achieve this with the Spring Boot @Bean auto-configuration annotation and being new to the Java environment I can't seem to get it working right. I can see that my bean is registering on startup but the outbound HTTP request is not being intercepted by it and it appears the original redirectBinding still is.

Here is my bean I added into my Configuration class:

@Bean(name="redirectBinding") @Primary public HTTPRedirectDeflateBinding HTTPRedirectDeflateBinding() { return new HTTPRedirectDeflateBinding(null, new My_SAML_HttpRedirectDeflateEncoder()); } 

Here is my encoder I'm trying to pass into the redirect binding

public class My_SAML_HttpRedirectDeflateEncoder extends HTTPRedirectDeflateEncoder{ @Override protected String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message) throws MessageEncodingException { URLBuilder urlBuilder = new URLBuilder(endpointURL); List<Pair<String, String>> queryParams = urlBuilder.getQueryParams(); if (messagesContext.getOutboundSAMLMessage() instanceof RequestAbstractType) { queryParams.add(new Pair<String, String>("service", "myService")); queryParams.add(new Pair<String, String>("serviceType", "dev")); } return urlBuilder.buildURL(); } 

}

I also attempted the solution proposed from this SO response Spring Boot Adding Http Request Interceptors Similar results, my HandlerInterceptor bean was registered but nothing is being intercepted. I feel like I'm missing a small detail. Any help would be appreciated.

In reference to this SO question Add request parameter to SAML request using Spring Security SAML

I am wanting to replace the default HTTPRedirectDeflateBinding bean with my own that has a custom HTTPRedirectDeflateEncoder to add query params to my SAML request.

I'm trying to achieve this with the Spring Boot @Bean annotation and being new to the Java environment I can't seem to get it working right. I can see that my bean is registering on startup but the outbound HTTP request is not being intercepted by it and it appears the original redirectBinding still is.

Here is my bean I added into my Configuration class:

@Bean(name="redirectBinding") @Primary public HTTPRedirectDeflateBinding HTTPRedirectDeflateBinding() { return new HTTPRedirectDeflateBinding(null, new My_SAML_HttpRedirectDeflateEncoder()); } 

Here is my encoder I'm trying to pass into the redirect binding

public class My_SAML_HttpRedirectDeflateEncoder extends HTTPRedirectDeflateEncoder{ @Override protected String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message) throws MessageEncodingException { URLBuilder urlBuilder = new URLBuilder(endpointURL); List<Pair<String, String>> queryParams = urlBuilder.getQueryParams(); if (messagesContext.getOutboundSAMLMessage() instanceof RequestAbstractType) { queryParams.add(new Pair<String, String>("service", "myService")); queryParams.add(new Pair<String, String>("serviceType", "dev")); } return urlBuilder.buildURL(); } 

}

I also attempted the solution proposed from this SO response Spring Boot Adding Http Request Interceptors Similar results, my HandlerInterceptor bean was registered but nothing is being intercepted. I feel like I'm missing a small detail. Any help would be appreciated.

In reference to this SO question Add request parameter to SAML request using Spring Security SAML

I am wanting to replace the default HTTPRedirectDeflateBinding bean with my own that has a custom HTTPRedirectDeflateEncoder to add query params to my SAML request.

I'm trying to achieve this with the Spring Boot @Bean auto-configuration annotation and being new to the Java environment I can't seem to get it working right. I can see that my bean is registering on startup but the outbound HTTP request is not being intercepted by it and it appears the original redirectBinding still is.

Here is my bean I added into my Configuration class:

@Bean(name="redirectBinding") @Primary public HTTPRedirectDeflateBinding HTTPRedirectDeflateBinding() { return new HTTPRedirectDeflateBinding(null, new My_SAML_HttpRedirectDeflateEncoder()); } 

Here is my encoder I'm trying to pass into the redirect binding

public class My_SAML_HttpRedirectDeflateEncoder extends HTTPRedirectDeflateEncoder{ @Override protected String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message) throws MessageEncodingException { URLBuilder urlBuilder = new URLBuilder(endpointURL); List<Pair<String, String>> queryParams = urlBuilder.getQueryParams(); if (messagesContext.getOutboundSAMLMessage() instanceof RequestAbstractType) { queryParams.add(new Pair<String, String>("service", "myService")); queryParams.add(new Pair<String, String>("serviceType", "dev")); } return urlBuilder.buildURL(); } 

}

I also attempted the solution proposed from this SO response Spring Boot Adding Http Request Interceptors Similar results, my HandlerInterceptor bean was registered but nothing is being intercepted. I feel like I'm missing a small detail. Any help would be appreciated.

added 1 character in body
Source Link
Fratt
  • 249
  • 4
  • 14

In reference to this SO question Add request parameter to SAML request using Spring Security SAML

I am wanting to replace the default HTTPRedirectDeflateBinding bean with my own that has a custom HTTPRedirectDeflateEncoder to add query params to my SAML request.

I'm trying to achieve this with the Spring Boot @Bean annotation and being new to the Java environment I can't seem to get it working right. I can see that my bean is registering on startup but the outbound HTTP request is not being intercepted by it and it appears the original redirectBinding still is.

Here is my bean I added into my Configuration class:

@Bean(name="redirectBinding") @Primary public HTTPRedirectDeflateBinding HTTPRedirectDeflateBinding() { return new HTTPRedirectDeflateBinding(null, new My_SAML_HttpRedirectDeflateEncoder()); } 

Here is my encoder I'm trying to pass into the redirect binding

public class My_SAML_HttpRedirectDeflateEncoder extends HTTPRedirectDeflateEncoder{ @Override protected String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message) throws MessageEncodingException { URLBuilder urlBuilder = new URLBuilder(endpointURL); List<Pair<String, String>> queryParams = urlBuilder.getQueryParams(); if (messagesContext.getOutboundSAMLMessage() instanceof RequestAbstractType) { queryParams.add(new Pair<String, String>("service", "myService")); queryParams.add(new Pair<String, String>("serviceType", "dev")); } return urlBuilder.buildURL(); } 

}

I also attempted the solution proposed from this SO response Spring Boot Adding Http Request Interceptors Similar results, my HandlerInterceptor bean was registered bybut nothing is being intercepted. I feel like I'm missing a small detail. Any help would be appreciated.

In reference to this SO question Add request parameter to SAML request using Spring Security SAML

I am wanting to replace the default HTTPRedirectDeflateBinding bean with my own that has a custom HTTPRedirectDeflateEncoder to add query params to my SAML request.

I'm trying to achieve this with the Spring Boot @Bean annotation and being new to the Java environment I can't seem to get it working right. I can see that my bean is registering on startup but the outbound HTTP request is not being intercepted by it and it appears the original redirectBinding still is.

Here is my bean I added into my Configuration class:

@Bean(name="redirectBinding") @Primary public HTTPRedirectDeflateBinding HTTPRedirectDeflateBinding() { return new HTTPRedirectDeflateBinding(null, new My_SAML_HttpRedirectDeflateEncoder()); } 

Here is my encoder I'm trying to pass into the redirect binding

public class My_SAML_HttpRedirectDeflateEncoder extends HTTPRedirectDeflateEncoder{ @Override protected String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message) throws MessageEncodingException { URLBuilder urlBuilder = new URLBuilder(endpointURL); List<Pair<String, String>> queryParams = urlBuilder.getQueryParams(); if (messagesContext.getOutboundSAMLMessage() instanceof RequestAbstractType) { queryParams.add(new Pair<String, String>("service", "myService")); queryParams.add(new Pair<String, String>("serviceType", "dev")); } return urlBuilder.buildURL(); } 

}

I also attempted the solution proposed from this SO response Spring Boot Adding Http Request Interceptors Similar results, my HandlerInterceptor bean was registered by nothing is being intercepted. I feel like I'm missing a small detail. Any help would be appreciated.

In reference to this SO question Add request parameter to SAML request using Spring Security SAML

I am wanting to replace the default HTTPRedirectDeflateBinding bean with my own that has a custom HTTPRedirectDeflateEncoder to add query params to my SAML request.

I'm trying to achieve this with the Spring Boot @Bean annotation and being new to the Java environment I can't seem to get it working right. I can see that my bean is registering on startup but the outbound HTTP request is not being intercepted by it and it appears the original redirectBinding still is.

Here is my bean I added into my Configuration class:

@Bean(name="redirectBinding") @Primary public HTTPRedirectDeflateBinding HTTPRedirectDeflateBinding() { return new HTTPRedirectDeflateBinding(null, new My_SAML_HttpRedirectDeflateEncoder()); } 

Here is my encoder I'm trying to pass into the redirect binding

public class My_SAML_HttpRedirectDeflateEncoder extends HTTPRedirectDeflateEncoder{ @Override protected String buildRedirectURL(SAMLMessageContext messagesContext, String endpointURL, String message) throws MessageEncodingException { URLBuilder urlBuilder = new URLBuilder(endpointURL); List<Pair<String, String>> queryParams = urlBuilder.getQueryParams(); if (messagesContext.getOutboundSAMLMessage() instanceof RequestAbstractType) { queryParams.add(new Pair<String, String>("service", "myService")); queryParams.add(new Pair<String, String>("serviceType", "dev")); } return urlBuilder.buildURL(); } 

}

I also attempted the solution proposed from this SO response Spring Boot Adding Http Request Interceptors Similar results, my HandlerInterceptor bean was registered but nothing is being intercepted. I feel like I'm missing a small detail. Any help would be appreciated.

Source Link
Fratt
  • 249
  • 4
  • 14
Loading