Package com.espacogeek.geek.config
Class GraphQlCookieInterceptor
java.lang.Object
com.espacogeek.geek.config.GraphQlCookieInterceptor
- All Implemented Interfaces:
org.springframework.graphql.server.WebGraphQlInterceptor
@Configuration
public class GraphQlCookieInterceptor
extends Object
implements org.springframework.graphql.server.WebGraphQlInterceptor
Interceptor that manages
refreshToken HttpOnly cookie operations for login,
refreshToken, and logout GraphQL mutations.
Before execution begins, this interceptor injects shared containers into the
GraphQLContext:
"incomingRefreshToken"– the value of therefreshTokencookie from the incoming request, extracted from theCookieHTTP header. Controller methods read this value instead of using@CookieValue, which is not reliably resolved by Spring for GraphQL's argument resolver chain."pendingRefreshTokens"– controller methods add a refresh token here when one should be set as an HttpOnly cookie on the response."clearRefreshCookieHolder"– aboolean[1]array; controller methods set index[0]totrueto signal that the refresh token cookie should be cleared (e.g., on logout).
After execution completes, this interceptor reads the containers and writes the
appropriate Set-Cookie header to the HTTP response via
WebGraphQlResponse.getResponseHeaders().
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.graphql.server.WebGraphQlInterceptor
org.springframework.graphql.server.WebGraphQlInterceptor.Chain -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<org.springframework.graphql.server.WebGraphQlResponse> intercept(org.springframework.graphql.server.WebGraphQlRequest request, org.springframework.graphql.server.WebGraphQlInterceptor.Chain chain) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.graphql.server.WebGraphQlInterceptor
andThen, apply
-
Constructor Details
-
GraphQlCookieInterceptor
-
-
Method Details
-
intercept
@NonNull public reactor.core.publisher.Mono<org.springframework.graphql.server.WebGraphQlResponse> intercept(@NonNull org.springframework.graphql.server.WebGraphQlRequest request, @NonNull org.springframework.graphql.server.WebGraphQlInterceptor.Chain chain) - Specified by:
interceptin interfaceorg.springframework.graphql.server.WebGraphQlInterceptor
-