|
@@ -70,11 +70,9 @@ import org.springframework.security.config.annotation.web.configurers.SessionMan
|
|
import org.springframework.security.config.annotation.web.configurers.X509Configurer;
|
|
import org.springframework.security.config.annotation.web.configurers.X509Configurer;
|
|
import org.springframework.security.config.annotation.web.configurers.oauth2.client.OAuth2ClientConfigurer;
|
|
import org.springframework.security.config.annotation.web.configurers.oauth2.client.OAuth2ClientConfigurer;
|
|
import org.springframework.security.config.annotation.web.configurers.oauth2.client.OAuth2LoginConfigurer;
|
|
import org.springframework.security.config.annotation.web.configurers.oauth2.client.OAuth2LoginConfigurer;
|
|
-import org.springframework.security.config.annotation.web.configurers.oauth2.client.OidcLogoutConfigurer;
|
|
|
|
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer;
|
|
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer;
|
|
import org.springframework.security.config.annotation.web.configurers.saml2.Saml2LoginConfigurer;
|
|
import org.springframework.security.config.annotation.web.configurers.saml2.Saml2LoginConfigurer;
|
|
import org.springframework.security.config.annotation.web.configurers.saml2.Saml2LogoutConfigurer;
|
|
import org.springframework.security.config.annotation.web.configurers.saml2.Saml2LogoutConfigurer;
|
|
-import org.springframework.security.config.annotation.web.configurers.saml2.Saml2MetadataConfigurer;
|
|
|
|
import org.springframework.security.core.Authentication;
|
|
import org.springframework.security.core.Authentication;
|
|
import org.springframework.security.core.context.SecurityContext;
|
|
import org.springframework.security.core.context.SecurityContext;
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
@@ -286,13 +284,8 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link HeadersConfigurer} for further customizations
|
|
* @return the {@link HeadersConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #headers(Customizer)} or
|
|
|
|
- * {@code headers(Customizer.withDefaults())} to stick with defaults. See the <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
* @see HeadersConfigurer
|
|
* @see HeadersConfigurer
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public HeadersConfigurer<HttpSecurity> headers() throws Exception {
|
|
public HeadersConfigurer<HttpSecurity> headers() throws Exception {
|
|
return getOrApply(new HeadersConfigurer<>());
|
|
return getOrApply(new HeadersConfigurer<>());
|
|
}
|
|
}
|
|
@@ -405,12 +398,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* on the classpath a {@link HandlerMappingIntrospector} is used.
|
|
* on the classpath a {@link HandlerMappingIntrospector} is used.
|
|
* @return the {@link CorsConfigurer} for customizations
|
|
* @return the {@link CorsConfigurer} for customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #cors(Customizer)} or
|
|
|
|
- * {@code cors(Customizer.withDefaults())} to stick with defaults. See the <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public CorsConfigurer<HttpSecurity> cors() throws Exception {
|
|
public CorsConfigurer<HttpSecurity> cors() throws Exception {
|
|
return getOrApply(new CorsConfigurer<>());
|
|
return getOrApply(new CorsConfigurer<>());
|
|
}
|
|
}
|
|
@@ -497,13 +485,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* could return true.
|
|
* could return true.
|
|
* @return the {@link SessionManagementConfigurer} for further customizations
|
|
* @return the {@link SessionManagementConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #sessionManagement(Customizer)} or
|
|
|
|
- * {@code sessionManagement(Customizer.withDefaults())} to stick with defaults. See
|
|
|
|
- * the <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public SessionManagementConfigurer<HttpSecurity> sessionManagement() throws Exception {
|
|
public SessionManagementConfigurer<HttpSecurity> sessionManagement() throws Exception {
|
|
return getOrApply(new SessionManagementConfigurer<>());
|
|
return getOrApply(new SessionManagementConfigurer<>());
|
|
}
|
|
}
|
|
@@ -625,14 +607,8 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link PortMapperConfigurer} for further customizations
|
|
* @return the {@link PortMapperConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #portMapper(Customizer)} or
|
|
|
|
- * {@code portMapper(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
* @see #requiresChannel()
|
|
* @see #requiresChannel()
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public PortMapperConfigurer<HttpSecurity> portMapper() throws Exception {
|
|
public PortMapperConfigurer<HttpSecurity> portMapper() throws Exception {
|
|
return getOrApply(new PortMapperConfigurer<>());
|
|
return getOrApply(new PortMapperConfigurer<>());
|
|
}
|
|
}
|
|
@@ -762,12 +738,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* Servlet Container's documentation.
|
|
* Servlet Container's documentation.
|
|
* @return the {@link JeeConfigurer} for further customizations
|
|
* @return the {@link JeeConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #jee(Customizer)} or
|
|
|
|
- * {@code jee(Customizer.withDefaults())} to stick with defaults. See the <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public JeeConfigurer<HttpSecurity> jee() throws Exception {
|
|
public JeeConfigurer<HttpSecurity> jee() throws Exception {
|
|
return getOrApply(new JeeConfigurer<>());
|
|
return getOrApply(new JeeConfigurer<>());
|
|
}
|
|
}
|
|
@@ -878,12 +849,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link X509Configurer} for further customizations
|
|
* @return the {@link X509Configurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #x509(Customizer)} or
|
|
|
|
- * {@code x509(Customizer.withDefaults())} to stick with defaults. See the <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public X509Configurer<HttpSecurity> x509() throws Exception {
|
|
public X509Configurer<HttpSecurity> x509() throws Exception {
|
|
return getOrApply(new X509Configurer<>());
|
|
return getOrApply(new X509Configurer<>());
|
|
}
|
|
}
|
|
@@ -961,13 +927,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link RememberMeConfigurer} for further customizations
|
|
* @return the {@link RememberMeConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #rememberMe(Customizer)} or
|
|
|
|
- * {@code rememberMe(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public RememberMeConfigurer<HttpSecurity> rememberMe() throws Exception {
|
|
public RememberMeConfigurer<HttpSecurity> rememberMe() throws Exception {
|
|
return getOrApply(new RememberMeConfigurer<>());
|
|
return getOrApply(new RememberMeConfigurer<>());
|
|
}
|
|
}
|
|
@@ -1111,7 +1071,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link ExpressionUrlAuthorizationConfigurer} for further customizations
|
|
* @return the {@link ExpressionUrlAuthorizationConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #authorizeHttpRequests()} instead
|
|
|
|
|
|
+ * @deprecated Use {@link #authorizeHttpRequests()} instead
|
|
*/
|
|
*/
|
|
@Deprecated
|
|
@Deprecated
|
|
public ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry authorizeRequests()
|
|
public ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry authorizeRequests()
|
|
@@ -1226,7 +1186,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* for the {@link ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry}
|
|
* for the {@link ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry}
|
|
* @return the {@link HttpSecurity} for further customizations
|
|
* @return the {@link HttpSecurity} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #authorizeHttpRequests} instead
|
|
|
|
|
|
+ * @deprecated Use {@link #authorizeHttpRequests} instead
|
|
*/
|
|
*/
|
|
@Deprecated
|
|
@Deprecated
|
|
public HttpSecurity authorizeRequests(
|
|
public HttpSecurity authorizeRequests(
|
|
@@ -1341,10 +1301,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* @return the {@link HttpSecurity} for further customizations
|
|
* @return the {@link HttpSecurity} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
* @since 5.6
|
|
* @since 5.6
|
|
- * @deprecated For removal in 7.0. Use {@link #authorizeHttpRequests(Customizer)}
|
|
|
|
- * instead
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry authorizeHttpRequests()
|
|
public AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry authorizeHttpRequests()
|
|
throws Exception {
|
|
throws Exception {
|
|
ApplicationContext context = getContext();
|
|
ApplicationContext context = getContext();
|
|
@@ -1476,13 +1433,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* when using {@link EnableWebSecurity}.
|
|
* when using {@link EnableWebSecurity}.
|
|
* @return the {@link RequestCacheConfigurer} for further customizations
|
|
* @return the {@link RequestCacheConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #requestCache(Customizer)} or
|
|
|
|
- * {@code requestCache(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public RequestCacheConfigurer<HttpSecurity> requestCache() throws Exception {
|
|
public RequestCacheConfigurer<HttpSecurity> requestCache() throws Exception {
|
|
return getOrApply(new RequestCacheConfigurer<>());
|
|
return getOrApply(new RequestCacheConfigurer<>());
|
|
}
|
|
}
|
|
@@ -1533,13 +1484,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* {@link EnableWebSecurity}.
|
|
* {@link EnableWebSecurity}.
|
|
* @return the {@link ExceptionHandlingConfigurer} for further customizations
|
|
* @return the {@link ExceptionHandlingConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #exceptionHandling(Customizer)} or
|
|
|
|
- * {@code exceptionHandling(Customizer.withDefaults())} to stick with defaults. See
|
|
|
|
- * the <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public ExceptionHandlingConfigurer<HttpSecurity> exceptionHandling() throws Exception {
|
|
public ExceptionHandlingConfigurer<HttpSecurity> exceptionHandling() throws Exception {
|
|
return getOrApply(new ExceptionHandlingConfigurer<>());
|
|
return getOrApply(new ExceptionHandlingConfigurer<>());
|
|
}
|
|
}
|
|
@@ -1591,13 +1536,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* automatically applied when using {@link EnableWebSecurity}.
|
|
* automatically applied when using {@link EnableWebSecurity}.
|
|
* @return the {@link SecurityContextConfigurer} for further customizations
|
|
* @return the {@link SecurityContextConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #securityContext(Customizer)} or
|
|
|
|
- * {@code securityContext(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public SecurityContextConfigurer<HttpSecurity> securityContext() throws Exception {
|
|
public SecurityContextConfigurer<HttpSecurity> securityContext() throws Exception {
|
|
return getOrApply(new SecurityContextConfigurer<>());
|
|
return getOrApply(new SecurityContextConfigurer<>());
|
|
}
|
|
}
|
|
@@ -1642,13 +1581,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* {@link EnableWebSecurity}.
|
|
* {@link EnableWebSecurity}.
|
|
* @return the {@link ServletApiConfigurer} for further customizations
|
|
* @return the {@link ServletApiConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #servletApi(Customizer)} or
|
|
|
|
- * {@code servletApi(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public ServletApiConfigurer<HttpSecurity> servletApi() throws Exception {
|
|
public ServletApiConfigurer<HttpSecurity> servletApi() throws Exception {
|
|
return getOrApply(new ServletApiConfigurer<>());
|
|
return getOrApply(new ServletApiConfigurer<>());
|
|
}
|
|
}
|
|
@@ -1704,12 +1637,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link CsrfConfigurer} for further customizations
|
|
* @return the {@link CsrfConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #csrf(Customizer)} or
|
|
|
|
- * {@code csrf(Customizer.withDefaults())} to stick with defaults. See the <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public CsrfConfigurer<HttpSecurity> csrf() throws Exception {
|
|
public CsrfConfigurer<HttpSecurity> csrf() throws Exception {
|
|
ApplicationContext context = getContext();
|
|
ApplicationContext context = getContext();
|
|
return getOrApply(new CsrfConfigurer<>(context));
|
|
return getOrApply(new CsrfConfigurer<>(context));
|
|
@@ -1784,12 +1712,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link LogoutConfigurer} for further customizations
|
|
* @return the {@link LogoutConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #logout(Customizer)} or
|
|
|
|
- * {@code logout(Customizer.withDefaults())} to stick with defaults. See the <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public LogoutConfigurer<HttpSecurity> logout() throws Exception {
|
|
public LogoutConfigurer<HttpSecurity> logout() throws Exception {
|
|
return getOrApply(new LogoutConfigurer<>());
|
|
return getOrApply(new LogoutConfigurer<>());
|
|
}
|
|
}
|
|
@@ -1928,13 +1851,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link AnonymousConfigurer} for further customizations
|
|
* @return the {@link AnonymousConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #anonymous(Customizer)} or
|
|
|
|
- * {@code anonymous(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public AnonymousConfigurer<HttpSecurity> anonymous() throws Exception {
|
|
public AnonymousConfigurer<HttpSecurity> anonymous() throws Exception {
|
|
return getOrApply(new AnonymousConfigurer<>());
|
|
return getOrApply(new AnonymousConfigurer<>());
|
|
}
|
|
}
|
|
@@ -2097,14 +2014,8 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link FormLoginConfigurer} for further customizations
|
|
* @return the {@link FormLoginConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #formLogin(Customizer)} or
|
|
|
|
- * {@code formLogin(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
* @see FormLoginConfigurer#loginPage(String)
|
|
* @see FormLoginConfigurer#loginPage(String)
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public FormLoginConfigurer<HttpSecurity> formLogin() throws Exception {
|
|
public FormLoginConfigurer<HttpSecurity> formLogin() throws Exception {
|
|
return getOrApply(new FormLoginConfigurer<>());
|
|
return getOrApply(new FormLoginConfigurer<>());
|
|
}
|
|
}
|
|
@@ -2279,13 +2190,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* @return the {@link Saml2LoginConfigurer} for further customizations
|
|
* @return the {@link Saml2LoginConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
* @since 5.2
|
|
* @since 5.2
|
|
- * @deprecated For removal in 7.0. Use {@link #saml2Login(Customizer)} or
|
|
|
|
- * {@code saml2Login(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public Saml2LoginConfigurer<HttpSecurity> saml2Login() throws Exception {
|
|
public Saml2LoginConfigurer<HttpSecurity> saml2Login() throws Exception {
|
|
return getOrApply(new Saml2LoginConfigurer<>());
|
|
return getOrApply(new Saml2LoginConfigurer<>());
|
|
}
|
|
}
|
|
@@ -2515,119 +2420,11 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* @return the {@link Saml2LoginConfigurer} for further customizations
|
|
* @return the {@link Saml2LoginConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
* @since 5.6
|
|
* @since 5.6
|
|
- * @deprecated For removal in 7.0. Use {@link #saml2Logout(Customizer)} or
|
|
|
|
- * {@code saml2Logout(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public Saml2LogoutConfigurer<HttpSecurity> saml2Logout() throws Exception {
|
|
public Saml2LogoutConfigurer<HttpSecurity> saml2Logout() throws Exception {
|
|
return getOrApply(new Saml2LogoutConfigurer<>(getContext()));
|
|
return getOrApply(new Saml2LogoutConfigurer<>(getContext()));
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * Configures a SAML 2.0 metadata endpoint that presents relying party configurations
|
|
|
|
- * in an {@code <md:EntityDescriptor>} payload.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * By default, the endpoints are {@code /saml2/metadata} and
|
|
|
|
- * {@code /saml2/metadata/{registrationId}} though note that also
|
|
|
|
- * {@code /saml2/service-provider-metadata/{registrationId}} is recognized for
|
|
|
|
- * backward compatibility purposes.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * <h2>Example Configuration</h2>
|
|
|
|
- *
|
|
|
|
- * The following example shows the minimal configuration required, using a
|
|
|
|
- * hypothetical asserting party.
|
|
|
|
- *
|
|
|
|
- * <pre>
|
|
|
|
- * @EnableWebSecurity
|
|
|
|
- * @Configuration
|
|
|
|
- * public class Saml2LogoutSecurityConfig {
|
|
|
|
- * @Bean
|
|
|
|
- * public SecurityFilterChain web(HttpSecurity http) throws Exception {
|
|
|
|
- * http
|
|
|
|
- * .authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
|
|
|
|
- * .saml2Metadata(Customizer.withDefaults());
|
|
|
|
- * return http.build();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * @Bean
|
|
|
|
- * public RelyingPartyRegistrationRepository relyingPartyRegistrationRepository() {
|
|
|
|
- * RelyingPartyRegistration registration = RelyingPartyRegistrations
|
|
|
|
- * .withMetadataLocation("https://ap.example.org/metadata")
|
|
|
|
- * .registrationId("simple")
|
|
|
|
- * .build();
|
|
|
|
- * return new InMemoryRelyingPartyRegistrationRepository(registration);
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
- * </pre>
|
|
|
|
- * @param saml2MetadataConfigurer the {@link Customizer} to provide more options for
|
|
|
|
- * the {@link Saml2MetadataConfigurer}
|
|
|
|
- * @return the {@link HttpSecurity} for further customizations
|
|
|
|
- * @throws Exception
|
|
|
|
- * @since 6.1
|
|
|
|
- */
|
|
|
|
- public HttpSecurity saml2Metadata(Customizer<Saml2MetadataConfigurer<HttpSecurity>> saml2MetadataConfigurer)
|
|
|
|
- throws Exception {
|
|
|
|
- saml2MetadataConfigurer.customize(getOrApply(new Saml2MetadataConfigurer<>(getContext())));
|
|
|
|
- return HttpSecurity.this;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * Configures a SAML 2.0 metadata endpoint that presents relying party configurations
|
|
|
|
- * in an {@code <md:EntityDescriptor>} payload.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * By default, the endpoints are {@code /saml2/metadata} and
|
|
|
|
- * {@code /saml2/metadata/{registrationId}} though note that also
|
|
|
|
- * {@code /saml2/service-provider-metadata/{registrationId}} is recognized for
|
|
|
|
- * backward compatibility purposes.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * <h2>Example Configuration</h2>
|
|
|
|
- *
|
|
|
|
- * The following example shows the minimal configuration required, using a
|
|
|
|
- * hypothetical asserting party.
|
|
|
|
- *
|
|
|
|
- * <pre>
|
|
|
|
- * @EnableWebSecurity
|
|
|
|
- * @Configuration
|
|
|
|
- * public class Saml2LogoutSecurityConfig {
|
|
|
|
- * @Bean
|
|
|
|
- * public SecurityFilterChain web(HttpSecurity http) throws Exception {
|
|
|
|
- * http
|
|
|
|
- * .authorizeHttpRequests((authorize) -> authorize.anyRequest().authenticated())
|
|
|
|
- * .saml2Metadata(Customizer.withDefaults());
|
|
|
|
- * return http.build();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * @Bean
|
|
|
|
- * public RelyingPartyRegistrationRepository relyingPartyRegistrationRepository() {
|
|
|
|
- * RelyingPartyRegistration registration = RelyingPartyRegistrations
|
|
|
|
- * .withMetadataLocation("https://ap.example.org/metadata")
|
|
|
|
- * .registrationId("simple")
|
|
|
|
- * .build();
|
|
|
|
- * return new InMemoryRelyingPartyRegistrationRepository(registration);
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
- * </pre>
|
|
|
|
- * @return the {@link Saml2MetadataConfigurer} for further customizations
|
|
|
|
- * @throws Exception
|
|
|
|
- * @since 6.1
|
|
|
|
- * @deprecated For removal in 7.0. Use {@link #saml2Metadata(Customizer)} or
|
|
|
|
- * {@code saml2Metadata(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
- */
|
|
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
- public Saml2MetadataConfigurer<HttpSecurity> saml2Metadata() throws Exception {
|
|
|
|
- return getOrApply(new Saml2MetadataConfigurer<>(getContext()));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Configures authentication support using an OAuth 2.0 and/or OpenID Connect 1.0
|
|
* Configures authentication support using an OAuth 2.0 and/or OpenID Connect 1.0
|
|
* Provider. <br>
|
|
* Provider. <br>
|
|
@@ -2714,11 +2511,6 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* @return the {@link OAuth2LoginConfigurer} for further customizations
|
|
* @return the {@link OAuth2LoginConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
* @since 5.0
|
|
* @since 5.0
|
|
- * @deprecated For removal in 7.0. Use {@link #oauth2Login(Customizer)} or
|
|
|
|
- * {@code oauth2Login(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
* @see <a target="_blank" href=
|
|
* @see <a target="_blank" href=
|
|
* "https://tools.ietf.org/html/rfc6749#section-4.1">Section 4.1 Authorization Code
|
|
* "https://tools.ietf.org/html/rfc6749#section-4.1">Section 4.1 Authorization Code
|
|
* Grant</a>
|
|
* Grant</a>
|
|
@@ -2728,7 +2520,6 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* @see org.springframework.security.oauth2.client.registration.ClientRegistration
|
|
* @see org.springframework.security.oauth2.client.registration.ClientRegistration
|
|
* @see org.springframework.security.oauth2.client.registration.ClientRegistrationRepository
|
|
* @see org.springframework.security.oauth2.client.registration.ClientRegistrationRepository
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public OAuth2LoginConfigurer<HttpSecurity> oauth2Login() throws Exception {
|
|
public OAuth2LoginConfigurer<HttpSecurity> oauth2Login() throws Exception {
|
|
return getOrApply(new OAuth2LoginConfigurer<>());
|
|
return getOrApply(new OAuth2LoginConfigurer<>());
|
|
}
|
|
}
|
|
@@ -2836,31 +2627,15 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
return HttpSecurity.this;
|
|
return HttpSecurity.this;
|
|
}
|
|
}
|
|
|
|
|
|
- public OidcLogoutConfigurer<HttpSecurity> oidcLogout() throws Exception {
|
|
|
|
- return getOrApply(new OidcLogoutConfigurer<>());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public HttpSecurity oidcLogout(Customizer<OidcLogoutConfigurer<HttpSecurity>> oidcLogoutCustomizer)
|
|
|
|
- throws Exception {
|
|
|
|
- oidcLogoutCustomizer.customize(getOrApply(new OidcLogoutConfigurer<>()));
|
|
|
|
- return HttpSecurity.this;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* Configures OAuth 2.0 Client support.
|
|
* Configures OAuth 2.0 Client support.
|
|
* @return the {@link OAuth2ClientConfigurer} for further customizations
|
|
* @return the {@link OAuth2ClientConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
* @since 5.1
|
|
* @since 5.1
|
|
- * @deprecated For removal in 7.0. Use {@link #oauth2Client(Customizer)} or
|
|
|
|
- * {@code oauth2Client(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
* @see <a target="_blank" href=
|
|
* @see <a target="_blank" href=
|
|
* "https://tools.ietf.org/html/rfc6749#section-1.1">OAuth 2.0 Authorization
|
|
* "https://tools.ietf.org/html/rfc6749#section-1.1">OAuth 2.0 Authorization
|
|
* Framework</a>
|
|
* Framework</a>
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public OAuth2ClientConfigurer<HttpSecurity> oauth2Client() throws Exception {
|
|
public OAuth2ClientConfigurer<HttpSecurity> oauth2Client() throws Exception {
|
|
OAuth2ClientConfigurer<HttpSecurity> configurer = getOrApply(new OAuth2ClientConfigurer<>());
|
|
OAuth2ClientConfigurer<HttpSecurity> configurer = getOrApply(new OAuth2ClientConfigurer<>());
|
|
this.postProcess(configurer);
|
|
this.postProcess(configurer);
|
|
@@ -2911,13 +2686,10 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* @return the {@link OAuth2ResourceServerConfigurer} for further customizations
|
|
* @return the {@link OAuth2ResourceServerConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
* @since 5.1
|
|
* @since 5.1
|
|
- * @deprecated For removal in 7.0. Use {@link #oauth2ResourceServer(Customizer)}
|
|
|
|
- * instead
|
|
|
|
* @see <a target="_blank" href=
|
|
* @see <a target="_blank" href=
|
|
* "https://tools.ietf.org/html/rfc6749#section-1.1">OAuth 2.0 Authorization
|
|
* "https://tools.ietf.org/html/rfc6749#section-1.1">OAuth 2.0 Authorization
|
|
* Framework</a>
|
|
* Framework</a>
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public OAuth2ResourceServerConfigurer<HttpSecurity> oauth2ResourceServer() throws Exception {
|
|
public OAuth2ResourceServerConfigurer<HttpSecurity> oauth2ResourceServer() throws Exception {
|
|
OAuth2ResourceServerConfigurer<HttpSecurity> configurer = getOrApply(
|
|
OAuth2ResourceServerConfigurer<HttpSecurity> configurer = getOrApply(
|
|
new OAuth2ResourceServerConfigurer<>(getContext()));
|
|
new OAuth2ResourceServerConfigurer<>(getContext()));
|
|
@@ -3015,13 +2787,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link ChannelSecurityConfigurer} for further customizations
|
|
* @return the {@link ChannelSecurityConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #requiresChannel(Customizer)} or
|
|
|
|
- * {@code requiresChannel(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public ChannelSecurityConfigurer<HttpSecurity>.ChannelRequestMatcherRegistry requiresChannel() throws Exception {
|
|
public ChannelSecurityConfigurer<HttpSecurity>.ChannelRequestMatcherRegistry requiresChannel() throws Exception {
|
|
ApplicationContext context = getContext();
|
|
ApplicationContext context = getContext();
|
|
return getOrApply(new ChannelSecurityConfigurer<>(context)).getRegistry();
|
|
return getOrApply(new ChannelSecurityConfigurer<>(context)).getRegistry();
|
|
@@ -3116,13 +2882,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link HttpBasicConfigurer} for further customizations
|
|
* @return the {@link HttpBasicConfigurer} for further customizations
|
|
* @throws Exception
|
|
* @throws Exception
|
|
- * @deprecated For removal in 7.0. Use {@link #httpBasic(Customizer)} or
|
|
|
|
- * {@code httpBasic(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public HttpBasicConfigurer<HttpSecurity> httpBasic() throws Exception {
|
|
public HttpBasicConfigurer<HttpSecurity> httpBasic() throws Exception {
|
|
return getOrApply(new HttpBasicConfigurer<>());
|
|
return getOrApply(new HttpBasicConfigurer<>());
|
|
}
|
|
}
|
|
@@ -3451,13 +3211,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
* }
|
|
* }
|
|
* </pre>
|
|
* </pre>
|
|
* @return the {@link RequestMatcherConfigurer} for further customizations
|
|
* @return the {@link RequestMatcherConfigurer} for further customizations
|
|
- * @deprecated For removal in 7.0. Use {@link #securityMatchers(Customizer)} or
|
|
|
|
- * {@code securityMatchers(Customizer.withDefaults())} to stick with defaults. See the
|
|
|
|
- * <a href=
|
|
|
|
- * "https://docs.spring.io/spring-security/reference/migration-7/configuration.html#_use_the_lambda_dsl">documentation</a>
|
|
|
|
- * for more details.
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public RequestMatcherConfigurer securityMatchers() {
|
|
public RequestMatcherConfigurer securityMatchers() {
|
|
return this.requestMatcherConfigurer;
|
|
return this.requestMatcherConfigurer;
|
|
}
|
|
}
|
|
@@ -3715,28 +3469,7 @@ public final class HttpSecurity extends AbstractConfiguredSecurityBuilder<Defaul
|
|
/**
|
|
/**
|
|
* Return the {@link HttpSecurity} for further customizations
|
|
* Return the {@link HttpSecurity} for further customizations
|
|
* @return the {@link HttpSecurity} for further customizations
|
|
* @return the {@link HttpSecurity} for further customizations
|
|
- * @deprecated Use the lambda based configuration instead. For example: <pre>
|
|
|
|
- * @Configuration
|
|
|
|
- * @EnableWebSecurity
|
|
|
|
- * public class SecurityConfig {
|
|
|
|
- *
|
|
|
|
- * @Bean
|
|
|
|
- * public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
|
|
|
- * http
|
|
|
|
- * .securityMatchers((matchers) -> matchers
|
|
|
|
- * .requestMatchers("/api/**")
|
|
|
|
- * )
|
|
|
|
- * .authorizeHttpRequests((authorize) -> authorize
|
|
|
|
- * .anyRequest().hasRole("USER")
|
|
|
|
- * )
|
|
|
|
- * .httpBasic(Customizer.withDefaults());
|
|
|
|
- * return http.build();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- * </pre>
|
|
|
|
*/
|
|
*/
|
|
- @Deprecated(since = "6.1", forRemoval = true)
|
|
|
|
public HttpSecurity and() {
|
|
public HttpSecurity and() {
|
|
return HttpSecurity.this;
|
|
return HttpSecurity.this;
|
|
}
|
|
}
|