Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter to force WebSession::save. #166

Merged
merged 1 commit into from
Jan 17, 2018

Conversation

gregturn
Copy link
Contributor

In some scenarios, such as making a remote call while using Spring Session between two processes, forcing a WebSession::save before making the call ensures that session data is in place on the other side.

Resolves #58.

@codecov-io
Copy link

codecov-io commented Jan 17, 2018

Codecov Report

Merging #166 into master will increase coverage by 2.07%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #166      +/-   ##
==========================================
+ Coverage   67.07%   69.15%   +2.07%     
==========================================
  Files           4       86      +82     
  Lines         243     1838    +1595     
  Branches       17      131     +114     
==========================================
+ Hits          163     1271    +1108     
- Misses         68      495     +427     
- Partials       12       72      +60
Impacted Files Coverage Δ
...cloud/gateway/route/builder/GatewayFilterSpec.java 34.09% <0%> (ø)
...ilter/factory/SaveSessionGatewayFilterFactory.java 100% <100%> (ø)
...cloud/gateway/config/GatewayAutoConfiguration.java 100% <100%> (ø)
.../filter/factory/SetStatusGatewayFilterFactory.java 90.9% <0%> (ø)
...filter/factory/RedirectToGatewayFilterFactory.java 80% <0%> (ø)
...org/springframework/cloud/gateway/route/Route.java 70.14% <0%> (ø)
...d/gateway/sample/ThrottleGatewayFilterFactory.java 38.88% <0%> (ø)
...ay/handler/support/RoutePredicateFactoryUtils.java 66.66% <0%> (ø)
...oud/gateway/route/builder/RouteLocatorBuilder.java 89.28% <0%> (ø)
...cloud/gateway/filter/LoadBalancerClientFilter.java 100% <0%> (ø)
... and 75 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6fe7207...3cdf9a4. Read the comment docs.

Copy link
Member

@spencergibb spencergibb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert import formatting and add docs

import org.springframework.cloud.gateway.filter.factory.SetRequestHeaderGatewayFilterFactory;
import org.springframework.cloud.gateway.filter.factory.SetResponseHeaderGatewayFilterFactory;
import org.springframework.cloud.gateway.filter.factory.SetStatusGatewayFilterFactory;
import org.springframework.cloud.gateway.filter.factory.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No star imports please.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, undo all import changes for this file except the one add line.

@@ -16,6 +16,8 @@

package org.springframework.cloud.gateway.route.builder;

import static org.springframework.tuple.TupleBuilder.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, undo import cleanup.

.expectComplete()
.verify(Duration.ofMinutes(10));

verify(mockWebSession, times(2)).getAttributes();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this is arbitrary, could change. Is it needed?

@gregturn
Copy link
Contributor Author

@spencergibb Polished all imports and removed superfluous assertions.

In some scenarios, such as making a remote call while using Spring Session between two processes, forcing a WebSession::save before making the call ensures that session data is in place on the other side.

Resolves spring-cloud#58.
@spencergibb spencergibb merged commit 2f23bc3 into spring-cloud:master Jan 17, 2018
- SaveSession
----

If you are integrating http://projects.spring.io/spring-security/[Spring Security] with Spring Session, and want to ensure security details have been forwarded to the remote process, this is critical.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gregturn

If you are integrating Spring Security with Spring Session, ..., this is critical

In this part, does it mean that adding SaveSession filter is very important and it have to be applied, or adding this filter is dangerous and it should be avoided?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants