Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WW-5343 Make SecurityMemberAccess an extensible bean #791

Merged
merged 20 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
79ffc86
WW-5343 Delete unused code and consolidate constructors
kusalk Aug 31, 2023
0825329
WW-5343 Extract ConfigParseUtil
kusalk Nov 14, 2023
b0b80ba
WW-5343 Extract deprecated methods as default interface methods
kusalk Nov 14, 2023
9e556e9
WW-5343 Deprecate unnecessary setter
kusalk Nov 14, 2023
90344b3
WW-5343 Make SecurityMemberAccess a prototype bean
kusalk Nov 14, 2023
7e92a8d
WW-5343 Refactor OgnlValueStackFactory to utilise SecurityMemberAcces…
kusalk Nov 14, 2023
b518635
WW-5343 Update OgnlUtil#createDefaultContext to utilise SecurityMembe…
kusalk Nov 14, 2023
4490d9d
WW-5343 Move configuration injection from OgnlUtil to SecurityMemberA…
kusalk Nov 14, 2023
8bf47b3
WW-5343 Fix OgnlUtilTest#testBeanMapExpressions
kusalk Nov 14, 2023
62988f7
WW-5343 Fix unit test compilation errors
kusalk Nov 14, 2023
ceff6cd
WW-5343 Remove unnecessary method
kusalk Nov 16, 2023
f87d7d7
WW-5343 Add missing license
kusalk Nov 17, 2023
a402e5c
WW-5343 Revert and fix serializability
kusalk Nov 17, 2023
d0d10d9
WW-5343 Fix MemberAccess access blocked tests
kusalk Nov 17, 2023
68f5584
WW-5343 Remove defunct test now that constant is required
kusalk Nov 17, 2023
05a9973
Merge branch 'master' into WW-5343-sec-extend
kusalk Nov 17, 2023
9640f5b
WW-5343 Migrate tests to SecurityMemberAccessTest
kusalk Nov 22, 2023
eba79a7
WW-5343 Fix final test
kusalk Nov 22, 2023
85d2c74
WW-5343 Clean up bootstrap constants
kusalk Nov 26, 2023
7929d86
WW-5343 Address SonarCloud code smells
kusalk Nov 26, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WW-5343 Revert and fix serializability
  • Loading branch information
kusalk committed Nov 17, 2023
commit a402e5c80a4fb5d3e98b1ab857549981269468e1
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.TextProvider;
import com.opensymphony.xwork2.conversion.impl.XWorkConverter;
import com.opensymphony.xwork2.inject.Container;
import com.opensymphony.xwork2.inject.Inject;
import com.opensymphony.xwork2.ognl.accessor.CompoundRootAccessor;
import com.opensymphony.xwork2.util.ClearableValueStack;
Expand All @@ -33,6 +34,7 @@
import ognl.Ognl;
import ognl.OgnlContext;
import ognl.OgnlException;
import ognl.PropertyAccessor;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down Expand Up @@ -515,6 +517,22 @@ public int size() {
return root.size();
}

/**
* Retained for serializability - see {@link com.opensymphony.xwork2.ognl.OgnlValueStackTest#testSerializable}
*/
private Object readResolve() {
// TODO: this should be done better
ActionContext ac = ActionContext.getContext();
Container cont = ac.getContainer();
XWorkConverter xworkConverter = cont.getInstance(XWorkConverter.class);
CompoundRootAccessor accessor = (CompoundRootAccessor) cont.getInstance(PropertyAccessor.class, CompoundRoot.class.getName());
TextProvider prov = cont.getInstance(TextProvider.class, "system");
SecurityMemberAccess sma = cont.getInstance(SecurityMemberAccess.class);
OgnlValueStack aStack = new OgnlValueStack(xworkConverter, accessor, prov, sma);
aStack.setOgnlUtil(cont.getInstance(OgnlUtil.class));
aStack.setRoot(xworkConverter, accessor, this.root, sma);
return aStack;
}

public void clearContextValues() {
//this is an OGNL ValueStack so the context will be an OgnlContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ public String toString() {
return LocationUtils.toString(this);
}

/**
* Ensure serialized unknown location resolve to {@link Location#UNKNOWN}.
*
* @return resolved location as object
*/
private Object readResolve() {
return this.equals(Location.UNKNOWN) ? Location.UNKNOWN : this;
}

private boolean testEquals(Object object1, Object object2) {
if (object1 == object2) {
return true;
Expand Down