Skip to content

Instantly share code, notes, and snippets.

package org.springframework.security.oauth2.client.web.reactive.function.client;
import java.net.URI;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.util.Optional;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
@tschlegel
tschlegel / TokenRelayWithRefreshGatewayFilterFactory.java
Last active October 15, 2024 09:11
TokenReplayWithTokenRefresh with Spring Boot 2.2.0+
package com.example.gatewaywithtokenrelay.filter;
import java.time.Duration;
import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.client.OAuth2AuthorizeRequest;
import org.springframework.security.oauth2.client.OAuth2AuthorizedClient;
import org.springframework.security.oauth2.client.ReactiveOAuth2AuthorizedClientManager;