SEC-1158: Decoupling of Pre/Post annotations implementation from Spring EL.
This commit is contained in:
parent
9875cbec8b
commit
d5b7ce69cc
|
@ -4,7 +4,7 @@ import org.springframework.expression.EvaluationContext;
|
||||||
import org.springframework.expression.ExpressionParser;
|
import org.springframework.expression.ExpressionParser;
|
||||||
import org.springframework.expression.spel.antlr.SpelAntlrExpressionParser;
|
import org.springframework.expression.spel.antlr.SpelAntlrExpressionParser;
|
||||||
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
||||||
import org.springframework.security.access.expression.support.SecurityExpressionRoot;
|
import org.springframework.security.access.expression.SecurityExpressionRoot;
|
||||||
import org.springframework.security.authentication.AuthenticationTrustResolver;
|
import org.springframework.security.authentication.AuthenticationTrustResolver;
|
||||||
import org.springframework.security.authentication.AuthenticationTrustResolverImpl;
|
import org.springframework.security.authentication.AuthenticationTrustResolverImpl;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
|
@ -16,7 +16,7 @@ import org.springframework.security.web.FilterInvocation;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class DefaultWebSecurityExpressionHandler implements WebSecurityExpressionHandler {
|
public class DefaultWebSecurityExpressionHandler implements WebSecurityExpressionHandler {
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.springframework.util.Assert;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public final class ExpressionBasedFilterInvocationSecurityMetadataSource extends DefaultFilterInvocationSecurityMetadataSource {
|
public final class ExpressionBasedFilterInvocationSecurityMetadataSource extends DefaultFilterInvocationSecurityMetadataSource {
|
||||||
private final static Log logger = LogFactory.getLog(ExpressionBasedFilterInvocationSecurityMetadataSource.class);
|
private final static Log logger = LogFactory.getLog(ExpressionBasedFilterInvocationSecurityMetadataSource.class);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.springframework.security.access.ConfigAttribute;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
class WebExpressionConfigAttribute implements ConfigAttribute {
|
class WebExpressionConfigAttribute implements ConfigAttribute {
|
||||||
private final Expression authorizeExpression;
|
private final Expression authorizeExpression;
|
||||||
|
|
|
@ -3,9 +3,9 @@ package org.springframework.security.web.access.expression;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.expression.EvaluationContext;
|
import org.springframework.expression.EvaluationContext;
|
||||||
|
import org.springframework.security.access.AccessDecisionVoter;
|
||||||
import org.springframework.security.access.ConfigAttribute;
|
import org.springframework.security.access.ConfigAttribute;
|
||||||
import org.springframework.security.access.expression.ExpressionUtils;
|
import org.springframework.security.access.expression.ExpressionUtils;
|
||||||
import org.springframework.security.access.vote.AccessDecisionVoter;
|
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.web.FilterInvocation;
|
import org.springframework.security.web.FilterInvocation;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import org.springframework.security.web.FilterInvocation;
|
||||||
* Voter which handles web authorisation decisions.
|
* Voter which handles web authorisation decisions.
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class WebExpressionVoter implements AccessDecisionVoter {
|
public class WebExpressionVoter implements AccessDecisionVoter {
|
||||||
private WebSecurityExpressionHandler expressionHandler = new DefaultWebSecurityExpressionHandler();
|
private WebSecurityExpressionHandler expressionHandler = new DefaultWebSecurityExpressionHandler();
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import org.springframework.security.access.expression.support.SecurityExpressionRoot;
|
import org.springframework.security.access.expression.SecurityExpressionRoot;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.web.FilterInvocation;
|
import org.springframework.security.web.FilterInvocation;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
@ -13,7 +13,7 @@ import org.springframework.util.StringUtils;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
class WebSecurityExpressionRoot extends SecurityExpressionRoot {
|
class WebSecurityExpressionRoot extends SecurityExpressionRoot {
|
||||||
private FilterInvocation filterInvocation;
|
private FilterInvocation filterInvocation;
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
package org.springframework.security.web.access.intercept;
|
package org.springframework.security.web.access.intercept;
|
||||||
|
|
||||||
import org.springframework.security.access.intercept.SecurityMetadataSource;
|
import org.springframework.security.access.SecurityMetadataSource;
|
||||||
import org.springframework.security.web.FilterInvocation;
|
import org.springframework.security.web.FilterInvocation;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
|
|
||||||
package org.springframework.security.web.access.intercept;
|
package org.springframework.security.web.access.intercept;
|
||||||
|
|
||||||
|
import org.springframework.security.access.SecurityMetadataSource;
|
||||||
import org.springframework.security.access.intercept.AbstractSecurityInterceptor;
|
import org.springframework.security.access.intercept.AbstractSecurityInterceptor;
|
||||||
import org.springframework.security.access.intercept.InterceptorStatusToken;
|
import org.springframework.security.access.intercept.InterceptorStatusToken;
|
||||||
import org.springframework.security.access.intercept.SecurityMetadataSource;
|
|
||||||
import org.springframework.security.web.FilterChainOrder;
|
import org.springframework.security.web.FilterChainOrder;
|
||||||
import org.springframework.security.web.FilterInvocation;
|
import org.springframework.security.web.FilterInvocation;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.springframework.util.StringUtils;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractAuthenticationTargetUrlRequestHandler {
|
public abstract class AbstractAuthenticationTargetUrlRequestHandler {
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import org.springframework.security.core.AuthenticationException;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public interface AuthenticationFailureHandler {
|
public interface AuthenticationFailureHandler {
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.springframework.security.core.Authentication;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
* @see
|
* @see
|
||||||
*/
|
*/
|
||||||
public interface AuthenticationSuccessHandler {
|
public interface AuthenticationSuccessHandler {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.springframework.util.Assert;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class ExceptionMappingAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {
|
public class ExceptionMappingAuthenticationFailureHandler extends SimpleUrlAuthenticationFailureHandler {
|
||||||
private Map<String, String> failureUrlMap = new HashMap<String, String>();
|
private Map<String, String> failureUrlMap = new HashMap<String, String>();
|
||||||
|
|
|
@ -46,7 +46,7 @@ import org.springframework.util.StringUtils;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class SavedRequestAwareAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
|
public class SavedRequestAwareAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.springframework.util.Assert;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class SimpleUrlAuthenticationFailureHandler implements AuthenticationFailureHandler {
|
public class SimpleUrlAuthenticationFailureHandler implements AuthenticationFailureHandler {
|
||||||
private String defaultFailureUrl;
|
private String defaultFailureUrl;
|
||||||
|
|
|
@ -18,7 +18,7 @@ import org.springframework.security.core.Authentication;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public interface LogoutSuccessHandler {
|
public interface LogoutSuccessHandler {
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.springframework.security.web.authentication.AbstractAuthenticationTar
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class SimpleUrlLogoutSuccessHandler extends AbstractAuthenticationTargetUrlRequestHandler
|
public class SimpleUrlLogoutSuccessHandler extends AbstractAuthenticationTargetUrlRequestHandler
|
||||||
implements LogoutSuccessHandler {
|
implements LogoutSuccessHandler {
|
||||||
|
|
|
@ -10,7 +10,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class HttpRequestResponseHolder {
|
public class HttpRequestResponseHolder {
|
||||||
HttpServletRequest request;
|
HttpServletRequest request;
|
||||||
|
|
|
@ -53,7 +53,7 @@ import org.springframework.util.ReflectionUtils;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class HttpSessionSecurityContextRepository implements SecurityContextRepository {
|
public class HttpSessionSecurityContextRepository implements SecurityContextRepository {
|
||||||
public static final String SPRING_SECURITY_CONTEXT_KEY = "SPRING_SECURITY_CONTEXT";
|
public static final String SPRING_SECURITY_CONTEXT_KEY = "SPRING_SECURITY_CONTEXT";
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @author Marten Algesten
|
* @author Marten Algesten
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public abstract class SaveContextOnUpdateOrErrorResponseWrapper extends HttpServletResponseWrapper {
|
public abstract class SaveContextOnUpdateOrErrorResponseWrapper extends HttpServletResponseWrapper {
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.springframework.security.web.SpringSecurityFilter;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class SecurityContextPersistenceFilter extends SpringSecurityFilter {
|
public class SecurityContextPersistenceFilter extends SpringSecurityFilter {
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.springframework.security.core.context.SecurityContext;
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*
|
*
|
||||||
* @see SecurityContextPersistenceFilter
|
* @see SecurityContextPersistenceFilter
|
||||||
* @see HttpSessionSecurityContextRepository
|
* @see HttpSessionSecurityContextRepository
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.springframework.security.web.access.expression.WebSecurityExpressionR
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class WebSecurityExpressionRootTests {
|
public class WebSecurityExpressionRootTests {
|
||||||
|
|
||||||
|
|
|
@ -16,22 +16,6 @@
|
||||||
package org.springframework.security.web.authentication;
|
package org.springframework.security.web.authentication;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import org.springframework.security.MockFilterConfig;
|
|
||||||
|
|
||||||
import org.springframework.security.authentication.TestingAuthenticationToken;
|
|
||||||
import org.springframework.security.core.Authentication;
|
|
||||||
import org.springframework.security.core.GrantedAuthority;
|
|
||||||
import org.springframework.security.core.authority.GrantedAuthorityImpl;
|
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
|
||||||
import org.springframework.security.core.userdetails.memory.UserAttribute;
|
|
||||||
|
|
||||||
|
|
||||||
import org.springframework.security.web.authentication.AnonymousProcessingFilter;
|
|
||||||
|
|
||||||
import org.springframework.mock.web.MockHttpServletRequest;
|
|
||||||
import org.springframework.mock.web.MockHttpServletResponse;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -42,6 +26,17 @@ import javax.servlet.ServletException;
|
||||||
import javax.servlet.ServletRequest;
|
import javax.servlet.ServletRequest;
|
||||||
import javax.servlet.ServletResponse;
|
import javax.servlet.ServletResponse;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.springframework.mock.web.MockHttpServletRequest;
|
||||||
|
import org.springframework.mock.web.MockHttpServletResponse;
|
||||||
|
import org.springframework.security.authentication.TestingAuthenticationToken;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
import org.springframework.security.core.authority.GrantedAuthorityImpl;
|
||||||
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
|
import org.springframework.security.core.userdetails.memory.UserAttribute;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link AnonymousProcessingFilter}.
|
* Tests {@link AnonymousProcessingFilter}.
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.springframework.security.web.authentication.ui.DefaultLoginPageGenera
|
||||||
*
|
*
|
||||||
* @author Luke Taylor
|
* @author Luke Taylor
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 2.5
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class DefaultLoginPageGeneratingFilterTests {
|
public class DefaultLoginPageGeneratingFilterTests {
|
||||||
FilterChain chain = mock(FilterChain.class);
|
FilterChain chain = mock(FilterChain.class);
|
||||||
|
|
Loading…
Reference in New Issue