Skip to content

Commit b8be5e0

Browse files
author
Joffry Ferrater
committed
Refactor and renamed classes
1 parent 2b4e9ae commit b8be5e0

File tree

3 files changed

+7
-47
lines changed

3 files changed

+7
-47
lines changed
Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,14 @@
1515
import java.util.Optional;
1616
import org.slf4j.Logger;
1717
import org.slf4j.LoggerFactory;
18-
import org.springframework.security.access.expression.SecurityExpressionRoot;
19-
import org.springframework.security.access.expression.method.MethodSecurityExpressionOperations;
20-
import org.springframework.security.core.Authentication;
2118

22-
public abstract class AbacMethodSecurityExpressionRoot extends SecurityExpressionRoot implements
23-
MethodSecurityExpressionOperations {
19+
public abstract class AbacMethodSecurityExpression {
2420

25-
private static final Logger LOGGER = LoggerFactory.getLogger(AbacMethodSecurityExpressionRoot.class);
26-
27-
private Object filterObject;
28-
private Object returnObject;
21+
private static final Logger LOGGER = LoggerFactory.getLogger(AbacMethodSecurityExpression.class);
2922

3023
private PdpClient pdpClient;
3124

32-
/**
33-
* Creates a new instance
34-
*
35-
* @param authentication the {@link Authentication} to use. Cannot be null.
36-
* @param pdpClient the {@link PdpClient}
37-
*/
38-
public AbacMethodSecurityExpressionRoot(Authentication authentication, PdpClient pdpClient) {
39-
super(authentication);
25+
public AbacMethodSecurityExpression(PdpClient pdpClient) {
4026
this.pdpClient = pdpClient;
4127
}
4228

@@ -65,7 +51,6 @@ private Request getAllCategoriesRequest(String attributeId, List<Object> values)
6551
return request;
6652
}
6753

68-
6954
private boolean isPermitted(Response response) {
7055
final boolean isPermitted = "Permit".equals(response.getResults().get(0).getDecision());
7156
LOGGER.debug("isPermitted: {}", isPermitted);
@@ -81,31 +66,6 @@ private ResourceCategory createResourceCategoryRequest(String attributeId, List<
8166
return resourceCategory;
8267
}
8368

84-
@Override
85-
public void setFilterObject(Object filterObject) {
86-
this.filterObject = filterObject;
87-
}
88-
89-
@Override
90-
public Object getFilterObject() {
91-
return filterObject;
92-
}
93-
94-
@Override
95-
public void setReturnObject(Object returnObject) {
96-
this.returnObject = returnObject;
97-
}
98-
99-
@Override
100-
public Object getReturnObject() {
101-
return returnObject;
102-
}
103-
104-
@Override
105-
public Object getThis() {
106-
return this;
107-
}
108-
10969
protected Optional<List<AccessSubjectCategory>> addAccessSubjectCategoryRequest() {
11070
return Optional.empty();
11171
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626

2727
@RunWith(SpringRunner.class)
2828
@ContextConfiguration(classes = PepApplication.class, initializers = ConfigFileApplicationContextInitializer.class)
29-
public class AbacMethodSecurityExpressionRootTest extends TestBase {
29+
public class AbacMethodSecurityExpressionTest extends TestBase {
3030

31-
private AbacMethodSecurityExpressionRoot target;
31+
private AbacMethodSecurityExpression target;
3232

3333
@Autowired
3434
PdpClient pdpClient;
3535

3636
@Before
3737
public void setUp() {
38-
target = new AbacMethodSecurityExpressionRoot(new AuthenticationImpl(), pdpClient) {
38+
target = new AbacMethodSecurityExpression(pdpClient) {
3939

4040
@Override
4141
public boolean hasAccessToResource(String attributeId, List<Object> values) {

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ allprojects {
77
targetCompatibility = 1.8
88

99
group = 'com.github.joffryferrater'
10-
version = '0.3.1'
10+
version = '0.4.1'
1111

1212
repositories {
1313
mavenLocal()

0 commit comments

Comments
 (0)