mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-05 02:02:15 +00:00
Remove PrePostTemplateDefaults
Closes gh-17296 Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
This commit is contained in:
parent
21036c94b4
commit
d8043dc8a7
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -46,7 +46,6 @@ import org.springframework.security.authorization.method.PostAuthorizeAuthorizat
|
||||
import org.springframework.security.authorization.method.PostFilterAuthorizationMethodInterceptor;
|
||||
import org.springframework.security.authorization.method.PreAuthorizeAuthorizationManager;
|
||||
import org.springframework.security.authorization.method.PreFilterAuthorizationMethodInterceptor;
|
||||
import org.springframework.security.authorization.method.PrePostTemplateDefaults;
|
||||
import org.springframework.security.config.ObjectPostProcessor;
|
||||
import org.springframework.security.config.core.GrantedAuthorityDefaults;
|
||||
import org.springframework.security.core.annotation.AnnotationTemplateExpressionDefaults;
|
||||
@ -130,14 +129,6 @@ final class PrePostMethodSecurityConfiguration implements ImportAware, Applicati
|
||||
this.postFilterMethodInterceptor.setTemplateDefaults(templateDefaults);
|
||||
}
|
||||
|
||||
@Autowired(required = false)
|
||||
void setTemplateDefaults(PrePostTemplateDefaults templateDefaults) {
|
||||
this.preFilterMethodInterceptor.setTemplateDefaults(templateDefaults);
|
||||
this.preAuthorizeAuthorizationManager.setTemplateDefaults(templateDefaults);
|
||||
this.postAuthorizeAuthorizationManager.setTemplateDefaults(templateDefaults);
|
||||
this.postFilterMethodInterceptor.setTemplateDefaults(templateDefaults);
|
||||
}
|
||||
|
||||
@Autowired(required = false)
|
||||
void setExpressionHandler(MethodSecurityExpressionHandler expressionHandler) {
|
||||
this.preFilterMethodInterceptor.setExpressionHandler(expressionHandler);
|
||||
|
@ -42,7 +42,6 @@ import org.springframework.security.authorization.method.PostAuthorizeReactiveAu
|
||||
import org.springframework.security.authorization.method.PostFilterAuthorizationReactiveMethodInterceptor;
|
||||
import org.springframework.security.authorization.method.PreAuthorizeReactiveAuthorizationManager;
|
||||
import org.springframework.security.authorization.method.PreFilterAuthorizationReactiveMethodInterceptor;
|
||||
import org.springframework.security.authorization.method.PrePostTemplateDefaults;
|
||||
import org.springframework.security.config.ObjectPostProcessor;
|
||||
import org.springframework.security.config.core.GrantedAuthorityDefaults;
|
||||
import org.springframework.security.core.annotation.AnnotationTemplateExpressionDefaults;
|
||||
@ -112,14 +111,6 @@ final class ReactiveAuthorizationManagerMethodSecurityConfiguration
|
||||
this.postAuthorizeAuthorizationManager.setApplicationContext(context);
|
||||
}
|
||||
|
||||
@Autowired(required = false)
|
||||
void setTemplateDefaults(PrePostTemplateDefaults templateDefaults) {
|
||||
this.preFilterMethodInterceptor.setTemplateDefaults(templateDefaults);
|
||||
this.preAuthorizeAuthorizationManager.setTemplateDefaults(templateDefaults);
|
||||
this.postAuthorizeAuthorizationManager.setTemplateDefaults(templateDefaults);
|
||||
this.postFilterMethodInterceptor.setTemplateDefaults(templateDefaults);
|
||||
}
|
||||
|
||||
@Autowired(required = false)
|
||||
void setTemplateDefaults(AnnotationTemplateExpressionDefaults templateDefaults) {
|
||||
this.preFilterMethodInterceptor.setTemplateDefaults(templateDefaults);
|
||||
|
@ -103,7 +103,6 @@ import org.springframework.security.authorization.method.AuthorizationManagerBef
|
||||
import org.springframework.security.authorization.method.AuthorizeReturnObject;
|
||||
import org.springframework.security.authorization.method.MethodAuthorizationDeniedHandler;
|
||||
import org.springframework.security.authorization.method.MethodInvocationResult;
|
||||
import org.springframework.security.authorization.method.PrePostTemplateDefaults;
|
||||
import org.springframework.security.config.annotation.SecurityContextChangedListenerConfig;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.core.GrantedAuthorityDefaults;
|
||||
@ -665,7 +664,7 @@ public class PrePostMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser
|
||||
public void methodeWhenParameterizedPreAuthorizeMetaAnnotationThenPasses(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -674,7 +673,7 @@ public class PrePostMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser
|
||||
public void methodRoleWhenPreAuthorizeMetaAnnotationHardcodedParameterThenPasses(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -683,7 +682,7 @@ public class PrePostMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
public void methodWhenParameterizedAnnotationThenFails(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
MetaAnnotationService service = this.spring.getContext().getBean(MetaAnnotationService.class);
|
||||
@ -692,7 +691,7 @@ public class PrePostMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser(authorities = "SCOPE_message:read")
|
||||
public void methodWhenMultiplePlaceholdersHasAuthorityThenPasses(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -701,7 +700,7 @@ public class PrePostMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser(roles = "ADMIN")
|
||||
public void methodWhenMultiplePlaceholdersHasRoleThenPasses(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -710,7 +709,7 @@ public class PrePostMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser
|
||||
public void methodWhenPostAuthorizeMetaAnnotationThenAuthorizes(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -721,7 +720,7 @@ public class PrePostMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser
|
||||
public void methodWhenPreFilterMetaAnnotationThenFilters(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -731,7 +730,7 @@ public class PrePostMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser
|
||||
public void methodWhenPostFilterMetaAnnotationThenFilters(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -993,18 +992,6 @@ public class PrePostMethodSecurityConfigurationTests {
|
||||
assertThat(result).isEqualTo("classmask");
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser
|
||||
void postAuthorizeWhenNullDeniedMetaAnnotationThanWorks() {
|
||||
this.spring
|
||||
.register(MethodSecurityServiceEnabledConfig.class, LegacyMetaAnnotationPlaceholderConfig.class,
|
||||
MethodSecurityService.NullPostProcessor.class)
|
||||
.autowire();
|
||||
MethodSecurityService service = this.spring.getContext().getBean(MethodSecurityService.class);
|
||||
String result = service.postAuthorizeDeniedWithNullDenied();
|
||||
assertThat(result).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@WithMockUser
|
||||
void postAuthorizeWhenDeniedAndHandlerWithCustomAnnotationThenHandlerCanUseMaskFromOtherAnnotation() {
|
||||
@ -1687,22 +1674,6 @@ public class PrePostMethodSecurityConfigurationTests {
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableMethodSecurity
|
||||
static class LegacyMetaAnnotationPlaceholderConfig {
|
||||
|
||||
@Bean
|
||||
PrePostTemplateDefaults methodSecurityDefaults() {
|
||||
return new PrePostTemplateDefaults();
|
||||
}
|
||||
|
||||
@Bean
|
||||
MetaAnnotationService metaAnnotationService() {
|
||||
return new MetaAnnotationService();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableMethodSecurity
|
||||
static class MetaAnnotationPlaceholderConfig {
|
||||
|
@ -58,7 +58,6 @@ import org.springframework.security.authorization.method.AuthorizationAdvisor;
|
||||
import org.springframework.security.authorization.method.AuthorizationAdvisorProxyFactory;
|
||||
import org.springframework.security.authorization.method.AuthorizationAdvisorProxyFactory.TargetVisitor;
|
||||
import org.springframework.security.authorization.method.AuthorizeReturnObject;
|
||||
import org.springframework.security.authorization.method.PrePostTemplateDefaults;
|
||||
import org.springframework.security.config.test.SpringTestContext;
|
||||
import org.springframework.security.config.test.SpringTestContextExtension;
|
||||
import org.springframework.security.core.Authentication;
|
||||
@ -269,7 +268,7 @@ public class PrePostReactiveMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser
|
||||
public void methodeWhenParameterizedPreAuthorizeMetaAnnotationThenPasses(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -278,7 +277,7 @@ public class PrePostReactiveMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser
|
||||
public void methodRoleWhenPreAuthorizeMetaAnnotationHardcodedParameterThenPasses(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -287,7 +286,7 @@ public class PrePostReactiveMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
public void methodWhenParameterizedAnnotationThenFails(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
MetaAnnotationService service = this.spring.getContext().getBean(MetaAnnotationService.class);
|
||||
@ -296,7 +295,7 @@ public class PrePostReactiveMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser(authorities = "SCOPE_message:read")
|
||||
public void methodWhenMultiplePlaceholdersHasAuthorityThenPasses(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -305,7 +304,7 @@ public class PrePostReactiveMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser(roles = "ADMIN")
|
||||
public void methodWhenMultiplePlaceholdersHasRoleThenPasses(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -314,7 +313,7 @@ public class PrePostReactiveMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser
|
||||
public void methodWhenPostAuthorizeMetaAnnotationThenAuthorizes(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -325,7 +324,7 @@ public class PrePostReactiveMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser
|
||||
public void methodWhenPreFilterMetaAnnotationThenFilters(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -335,7 +334,7 @@ public class PrePostReactiveMethodSecurityConfigurationTests {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(classes = { LegacyMetaAnnotationPlaceholderConfig.class, MetaAnnotationPlaceholderConfig.class })
|
||||
@ValueSource(classes = { MetaAnnotationPlaceholderConfig.class })
|
||||
@WithMockUser
|
||||
public void methodWhenPostFilterMetaAnnotationThenFilters(Class<?> config) {
|
||||
this.spring.register(config).autowire();
|
||||
@ -564,22 +563,6 @@ public class PrePostReactiveMethodSecurityConfigurationTests {
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableReactiveMethodSecurity
|
||||
static class LegacyMetaAnnotationPlaceholderConfig {
|
||||
|
||||
@Bean
|
||||
PrePostTemplateDefaults methodSecurityDefaults() {
|
||||
return new PrePostTemplateDefaults();
|
||||
}
|
||||
|
||||
@Bean
|
||||
MetaAnnotationService metaAnnotationService() {
|
||||
return new MetaAnnotationService();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@EnableReactiveMethodSecurity
|
||||
static class MetaAnnotationPlaceholderConfig {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -77,13 +77,6 @@ abstract class AbstractExpressionAttributeRegistry<T extends ExpressionAttribute
|
||||
this.expressionHandler = expressionHandler;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
void setTemplateDefaults(PrePostTemplateDefaults defaults) {
|
||||
AnnotationTemplateExpressionDefaults adapter = new AnnotationTemplateExpressionDefaults();
|
||||
adapter.setIgnoreUnknown(defaults.isIgnoreUnknown());
|
||||
setTemplateDefaults(adapter);
|
||||
}
|
||||
|
||||
abstract void setTemplateDefaults(AnnotationTemplateExpressionDefaults adapter);
|
||||
|
||||
/**
|
||||
|
@ -51,21 +51,6 @@ public final class PostAuthorizeAuthorizationManager
|
||||
this.registry.setExpressionHandler(expressionHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
* By default, this value is <code>null</code>, which indicates that templates should
|
||||
* not be resolved.
|
||||
* @param defaults - whether to resolve pre/post-authorization templates parameters
|
||||
* @since 6.3
|
||||
* @deprecated Please use
|
||||
* {@link #setTemplateDefaults(AnnotationTemplateExpressionDefaults)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTemplateDefaults(PrePostTemplateDefaults defaults) {
|
||||
this.registry.setTemplateDefaults(defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
|
@ -52,21 +52,6 @@ public final class PostAuthorizeReactiveAuthorizationManager
|
||||
this.registry.setExpressionHandler(expressionHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
* By default, this value is <code>null</code>, which indicates that templates should
|
||||
* not be resolved.
|
||||
* @param defaults - whether to resolve pre/post-authorization templates parameters
|
||||
* @since 6.3
|
||||
* @deprecated please use
|
||||
* {@link #setTemplateDefaults(AnnotationTemplateExpressionDefaults)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTemplateDefaults(PrePostTemplateDefaults defaults) {
|
||||
this.registry.setTemplateDefaults(defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -67,20 +67,6 @@ public final class PostFilterAuthorizationMethodInterceptor implements Authoriza
|
||||
this.registry.setExpressionHandler(expressionHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
* By default, this value is <code>null</code>, which indicates that templates should
|
||||
* not be resolved.
|
||||
* @param defaults - whether to resolve pre/post-authorization templates parameters
|
||||
* @since 6.3
|
||||
* @deprecated Please use {@link AnnotationTemplateExpressionDefaults} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTemplateDefaults(PrePostTemplateDefaults defaults) {
|
||||
this.registry.setTemplateDefaults(defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -67,21 +67,6 @@ public final class PostFilterAuthorizationReactiveMethodInterceptor implements A
|
||||
this.registry.setExpressionHandler(expressionHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
* By default, this value is <code>null</code>, which indicates that templates should
|
||||
* not be resolved.
|
||||
* @param defaults - whether to resolve pre/post-authorization templates parameters
|
||||
* @since 6.3
|
||||
* @deprecated please use
|
||||
* {@link #setTemplateDefaults(AnnotationTemplateExpressionDefaults)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTemplateDefaults(PrePostTemplateDefaults defaults) {
|
||||
this.registry.setTemplateDefaults(defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
|
@ -51,21 +51,6 @@ public final class PreAuthorizeAuthorizationManager
|
||||
this.registry.setExpressionHandler(expressionHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
* By default, this value is <code>null</code>, which indicates that templates should
|
||||
* not be resolved.
|
||||
* @param defaults - whether to resolve pre/post-authorization templates parameters
|
||||
* @since 6.3
|
||||
* @deprecated Please use
|
||||
* {@link #setTemplateDefaults(AnnotationTemplateExpressionDefaults)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTemplateDefaults(PrePostTemplateDefaults defaults) {
|
||||
this.registry.setTemplateDefaults(defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
|
@ -51,21 +51,6 @@ public final class PreAuthorizeReactiveAuthorizationManager
|
||||
this.registry.setExpressionHandler(expressionHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
* By default, this value is <code>null</code>, which indicates that templates should
|
||||
* not be resolved.
|
||||
* @param defaults - whether to resolve pre/post-authorization templates parameters
|
||||
* @since 6.3
|
||||
* @deprecated please use
|
||||
* {@link #setTemplateDefaults(AnnotationTemplateExpressionDefaults)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTemplateDefaults(PrePostTemplateDefaults defaults) {
|
||||
this.registry.setTemplateDefaults(defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -68,21 +68,6 @@ public final class PreFilterAuthorizationMethodInterceptor implements Authorizat
|
||||
this.registry.setExpressionHandler(expressionHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
* By default, this value is <code>null</code>, which indicates that templates should
|
||||
* not be resolved.
|
||||
* @param defaults - whether to resolve pre/post-authorization templates parameters
|
||||
* @since 6.3
|
||||
* @deprecated Please use
|
||||
* {@link #setTemplateDefaults(AnnotationTemplateExpressionDefaults)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTemplateDefaults(PrePostTemplateDefaults defaults) {
|
||||
this.registry.setTemplateDefaults(defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -70,21 +70,6 @@ public final class PreFilterAuthorizationReactiveMethodInterceptor implements Au
|
||||
this.registry.setExpressionHandler(expressionHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
* By default, this value is <code>null</code>, which indicates that templates should
|
||||
* not be resolved.
|
||||
* @param defaults - whether to resolve pre/post-authorization templates parameters
|
||||
* @since 6.3
|
||||
* @deprecated please use
|
||||
* {@link #setTemplateDefaults(AnnotationTemplateExpressionDefaults)}
|
||||
*/
|
||||
@Deprecated
|
||||
public void setTemplateDefaults(PrePostTemplateDefaults defaults) {
|
||||
this.registry.setTemplateDefaults(defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure pre/post-authorization template resolution
|
||||
* <p>
|
||||
|
@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.security.authorization.method;
|
||||
|
||||
import org.springframework.security.core.annotation.AnnotationTemplateExpressionDefaults;
|
||||
|
||||
/**
|
||||
* A component for configuring various cross-cutting aspects of pre/post method security
|
||||
*
|
||||
* @author Josh Cummings
|
||||
* @since 6.3
|
||||
* @see org.springframework.security.access.prepost.PreAuthorize
|
||||
* @see org.springframework.security.access.prepost.PostAuthorize
|
||||
* @see org.springframework.security.access.prepost.PreFilter
|
||||
* @see org.springframework.security.access.prepost.PostFilter
|
||||
* @deprecated Please use {@link AnnotationTemplateExpressionDefaults} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public final class PrePostTemplateDefaults {
|
||||
|
||||
private boolean ignoreUnknown = true;
|
||||
|
||||
/**
|
||||
* Whether template resolution should ignore placeholders it doesn't recognize.
|
||||
* <p>
|
||||
* By default, this value is <code>true</code>.
|
||||
*/
|
||||
public boolean isIgnoreUnknown() {
|
||||
return this.ignoreUnknown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure template resolution to ignore unknown placeholders. When set to
|
||||
* <code>false</code>, template resolution will throw an exception for unknown
|
||||
* placeholders.
|
||||
* <p>
|
||||
* By default, this value is <code>true</code>.
|
||||
* @param ignoreUnknown - whether to ignore unknown placeholders parameters
|
||||
*/
|
||||
public void setIgnoreUnknown(boolean ignoreUnknown) {
|
||||
this.ignoreUnknown = ignoreUnknown;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user