Useful if the container is used behind a proxy.
This commit is contained in:
parent
1a2a84f674
commit
709dc23250
@ -1,8 +1,11 @@
|
|||||||
package se.su.dsv.oauth2;
|
package se.su.dsv.oauth2;
|
||||||
|
|
||||||
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Profile;
|
import org.springframework.context.annotation.Profile;
|
||||||
|
import org.springframework.core.Ordered;
|
||||||
|
import org.springframework.web.filter.ForwardedHeaderFilter;
|
||||||
import se.su.dsv.oauth2.admin.repository.ClientRepository;
|
import se.su.dsv.oauth2.admin.repository.ClientRepository;
|
||||||
import se.su.dsv.oauth2.admin.repository.ClientRow;
|
import se.su.dsv.oauth2.admin.repository.ClientRow;
|
||||||
|
|
||||||
@ -15,6 +18,16 @@ import java.util.Optional;
|
|||||||
@Configuration
|
@Configuration
|
||||||
@Profile("embedded")
|
@Profile("embedded")
|
||||||
public class EmbeddedConfiguration {
|
public class EmbeddedConfiguration {
|
||||||
|
/**
|
||||||
|
* This filter takes the `X-Forwarded-*` headers and updates the request to reflect the original HTTP request.
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public FilterRegistrationBean<ForwardedHeaderFilter> forwardedHeaderFilter() {
|
||||||
|
var filterRegistrationBean = new FilterRegistrationBean<>(new ForwardedHeaderFilter());
|
||||||
|
filterRegistrationBean.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
||||||
|
return filterRegistrationBean;
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ClientRepository clientRepository() {
|
public ClientRepository clientRepository() {
|
||||||
ArrayList<ClientRow> clients = new ArrayList<>();
|
ArrayList<ClientRow> clients = new ArrayList<>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user