From 5287db17e7b06ea4117cb7e5669bce2879a2051a Mon Sep 17 00:00:00 2001 From: Dreamstar Enterprises <39380005+dreamstar-enterprises@users.noreply.github.com> Date: Sun, 28 Jul 2024 00:07:45 +0100 Subject: [PATCH] Delete Spring BFF/gateway/routing/filters/GlobalFilters.kt --- .../gateway/routing/filters/GlobalFilters.kt | 64 ------------------- 1 file changed, 64 deletions(-) delete mode 100644 Spring BFF/gateway/routing/filters/GlobalFilters.kt diff --git a/Spring BFF/gateway/routing/filters/GlobalFilters.kt b/Spring BFF/gateway/routing/filters/GlobalFilters.kt deleted file mode 100644 index f644714..0000000 --- a/Spring BFF/gateway/routing/filters/GlobalFilters.kt +++ /dev/null @@ -1,64 +0,0 @@ -package com.example.gateway.routing.filters - -import org.springframework.beans.factory.ObjectProvider -import org.springframework.cloud.gateway.filter.GlobalFilter -import org.springframework.cloud.gateway.filter.factory.TokenRelayGatewayFilterFactory -import org.springframework.context.annotation.Bean -import org.springframework.context.annotation.Configuration -import org.springframework.security.oauth2.client.ReactiveOAuth2AuthorizedClientManager -import org.springframework.web.server.ServerWebExchange -import reactor.core.publisher.Mono - -/**********************************************************************************************************************/ -/******************************************************* FILTER *******************************************************/ -/**********************************************************************************************************************/ - -// The default implementation of ReactiveOAuth2AuthorizedClientService used by TokenRelayGatewayFilterFactory -// uses an in-memory data store. You will need to provide your own implementation of ReactiveOAuth2AuthorizedClientService -// if you need a more robust solution. - -//@Configuration -//internal class TokenRelayFilterConfig { -// -// @Bean -// fun tokenRelayGatewayFilterFactory( -// authorizedClientManagerProvider: ObjectProvider -// ): TokenRelayGatewayFilterFactory { -// return TokenRelayGatewayFilterFactory(authorizedClientManagerProvider) -// } -// -// @Bean -// fun tokenRelayGlobalFilter( -// tokenRelayGatewayFilterFactory: TokenRelayGatewayFilterFactory -// ): GlobalFilter { -// return GlobalFilter { exchange, chain -> -// tokenRelayGatewayFilterFactory.apply { -// // optionally configure TokenRelay if needed -// }.filter(exchange, chain) -// } -// } -//} - - -@Configuration -internal class CustomHeaderFilterConfig { - - @Bean - fun customHeaderFilter(): GlobalFilter { - return GlobalFilter { exchange, chain -> - chain.filter(exchange).then( - Mono.fromRunnable { - exchange.response.headers.add( - "X-Powered-By", - "DreamStar Enterprises" - ) - } - ) - } - } - -} - -/**********************************************************************************************************************/ -/**************************************************** END OF KOTLIN ***************************************************/ -/**********************************************************************************************************************/ \ No newline at end of file