mirror of
https://github.com/apache/struts.git
synced 2026-09-11 16:49:40 +00:00
Moves security related classes to security package
This commit is contained in:
@@ -144,7 +144,7 @@
|
||||
<bean type="ognl.PropertyAccessor" name="java.util.HashSet" class="com.opensymphony.xwork2.ognl.accessor.XWorkCollectionPropertyAccessor" />
|
||||
<bean type="ognl.PropertyAccessor" name="java.util.HashMap" class="com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor" />
|
||||
|
||||
<bean type="com.opensymphony.xwork2.ExcludedPatternsChecker" name="struts" class="com.opensymphony.xwork2.DefaultExcludedPatternsChecker" />
|
||||
<bean type="com.opensymphony.xwork2.ExcludedPatternsChecker" name="struts" class="com.opensymphony.xwork2.security.DefaultExcludedPatternsChecker" />
|
||||
|
||||
<package name="struts-default" abstract="true">
|
||||
<result-types>
|
||||
|
||||
@@ -24,7 +24,7 @@ package org.apache.struts2;
|
||||
import com.opensymphony.xwork2.Action;
|
||||
import com.opensymphony.xwork2.ActionProxyFactory;
|
||||
import com.opensymphony.xwork2.DefaultActionProxyFactory;
|
||||
import com.opensymphony.xwork2.DefaultExcludedPatternsChecker;
|
||||
import com.opensymphony.xwork2.security.DefaultExcludedPatternsChecker;
|
||||
import com.opensymphony.xwork2.ExcludedPatternsChecker;
|
||||
import com.opensymphony.xwork2.ObjectFactory;
|
||||
import com.opensymphony.xwork2.config.Configuration;
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.Map;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
|
||||
import com.opensymphony.xwork2.DefaultExcludedPatternsChecker;
|
||||
import com.opensymphony.xwork2.security.DefaultExcludedPatternsChecker;
|
||||
import com.opensymphony.xwork2.mock.MockActionInvocation;
|
||||
import org.easymock.MockControl;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.opensymphony.xwork2.config.providers;
|
||||
|
||||
import com.opensymphony.xwork2.ActionProxyFactory;
|
||||
import com.opensymphony.xwork2.DefaultActionProxyFactory;
|
||||
import com.opensymphony.xwork2.DefaultExcludedPatternsChecker;
|
||||
import com.opensymphony.xwork2.security.DefaultExcludedPatternsChecker;
|
||||
import com.opensymphony.xwork2.DefaultLocaleProvider;
|
||||
import com.opensymphony.xwork2.DefaultTextProvider;
|
||||
import com.opensymphony.xwork2.DefaultUnknownHandlerManager;
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
package com.opensymphony.xwork2;
|
||||
package com.opensymphony.xwork2.security;
|
||||
|
||||
import com.opensymphony.xwork2.*;
|
||||
import com.opensymphony.xwork2.inject.Inject;
|
||||
import com.opensymphony.xwork2.util.TextParseUtil;
|
||||
import com.opensymphony.xwork2.util.logging.Logger;
|
||||
@@ -10,7 +11,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class DefaultExcludedPatternsChecker implements ExcludedPatternsChecker {
|
||||
public class DefaultExcludedPatternsChecker implements com.opensymphony.xwork2.ExcludedPatternsChecker {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(DefaultExcludedPatternsChecker.class);
|
||||
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
package com.opensymphony.xwork2.security;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Used across different interceptors to check if given string matches one of the excluded patterns.
|
||||
*/
|
||||
public interface ExcludedPatternsChecker {
|
||||
|
||||
/**
|
||||
* Checks if value matches any of patterns on exclude list
|
||||
*
|
||||
* @param value to check
|
||||
* @return object containing result of matched pattern and pattern itself
|
||||
*/
|
||||
public IsExcluded isExcluded(String value);
|
||||
|
||||
/**
|
||||
* Allows add additional excluded patterns during runtime
|
||||
*
|
||||
* @param commaDelimitedPatterns comma delimited string with patterns
|
||||
*/
|
||||
public void addExcludedPatterns(String commaDelimitedPatterns);
|
||||
|
||||
/**
|
||||
* Allows add additional excluded patterns during runtime
|
||||
*
|
||||
* @param additionalPatterns array of additional excluded patterns
|
||||
*/
|
||||
public void addExcludedPatterns(String[] additionalPatterns);
|
||||
|
||||
/**
|
||||
* Allows add additional excluded patterns during runtime
|
||||
*
|
||||
* @param additionalPatterns set of additional patterns
|
||||
*/
|
||||
public void addExcludedPatterns(Set<String> additionalPatterns);
|
||||
|
||||
/**
|
||||
* Allow access list of all defined excluded patterns
|
||||
*
|
||||
* @return set of excluded patterns
|
||||
*/
|
||||
public Set<Pattern> getExcludedPatterns();
|
||||
|
||||
public final static class IsExcluded {
|
||||
|
||||
private final boolean excluded;
|
||||
private final Pattern excludedPattern;
|
||||
|
||||
public static IsExcluded yes(Pattern excludedPattern) {
|
||||
return new IsExcluded(true, excludedPattern);
|
||||
}
|
||||
|
||||
public static IsExcluded no() {
|
||||
return new IsExcluded(false, null);
|
||||
}
|
||||
|
||||
private IsExcluded(boolean excluded, Pattern excludedPattern) {
|
||||
this.excluded = excluded;
|
||||
this.excludedPattern = excludedPattern;
|
||||
}
|
||||
|
||||
public boolean isExcluded() {
|
||||
return excluded;
|
||||
}
|
||||
|
||||
public Pattern getExcludedPattern() {
|
||||
return excludedPattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IsExcluded { " +
|
||||
"excluded=" + excluded +
|
||||
", excludedPattern=" + excludedPattern +
|
||||
" }";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user