/** * Configures when this filter should redirect to https * * By default, the filter will redirect whenever an exchange's scheme is not https * * @param when determines when to redirect to https * @return the {@link HttpsRedirectSpec} for additional configuration */ public HttpsRedirectSpec httpsRedirectWhen( Function<ServerWebExchange, Boolean> when) { ServerWebExchangeMatcher matcher = e -> when.apply(e) ? ServerWebExchangeMatcher.MatchResult.match() : ServerWebExchangeMatcher.MatchResult.notMatch(); return httpsRedirectWhen(matcher); }
this.httpsRedirectSpec.configure(this);
@Bean SecurityWebFilterChain springSecurity(ServerHttpSecurity http) { // @formatter:off http .redirectToHttps() .portMapper(portMapper()); // @formatter:on return http.build(); }
this.httpsRedirectSpec.configure(this);
this.httpsRedirectSpec = new HttpsRedirectSpec(); return this.httpsRedirectSpec;
/** * Configures when this filter should redirect to https * * By default, the filter will redirect whenever an exchange's scheme is not https * * @param when determines when to redirect to https * @return the {@link HttpsRedirectSpec} for additional configuration */ public HttpsRedirectSpec httpsRedirectWhen( Function<ServerWebExchange, Boolean> when) { ServerWebExchangeMatcher matcher = e -> when.apply(e) ? ServerWebExchangeMatcher.MatchResult.match() : ServerWebExchangeMatcher.MatchResult.notMatch(); return httpsRedirectWhen(matcher); }
this.httpsRedirectSpec.configure(this);
this.httpsRedirectSpec = new HttpsRedirectSpec(); return this.httpsRedirectSpec;
/** * Configures when this filter should redirect to https * * By default, the filter will redirect whenever an exchange's scheme is not https * * @param when determines when to redirect to https * @return the {@link HttpsRedirectSpec} for additional configuration */ public HttpsRedirectSpec httpsRedirectWhen( Function<ServerWebExchange, Boolean> when) { ServerWebExchangeMatcher matcher = e -> when.apply(e) ? ServerWebExchangeMatcher.MatchResult.match() : ServerWebExchangeMatcher.MatchResult.notMatch(); return httpsRedirectWhen(matcher); }
this.httpsRedirectSpec = new HttpsRedirectSpec(); return this.httpsRedirectSpec;
@Bean SecurityWebFilterChain springSecurity(ServerHttpSecurity http) { // @formatter:off http .redirectToHttps() .httpsRedirectWhen(new PathPatternParserServerWebExchangeMatcher("/secure")); // @formatter:on return http.build(); } }