Skip to content

Commit b1c050d

Browse files
author
Chris Schmidt
committed
Added base SecurityComponent interface that all controls should inherit from
1 parent 1356264 commit b1c050d

7 files changed

Lines changed: 34 additions & 6 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package org.owasp.esapi.core;
2+
3+
import java.util.UUID;
4+
5+
/**
6+
* This is the very basic interface that all Security Control implementations should implement. It is expected that each
7+
* control/component will have a UUID associated with it so that locater services can locate the implementations based on
8+
* some registry and to allow multiple instances of single components to exist within an application.
9+
*
10+
* @author Chris Schmidt ([email protected]) http://www.ContrastSecurity.com
11+
*/
12+
public interface SecurityComponent {
13+
/**
14+
* Returns the Unique Identifier for this component/control instance.
15+
* @return Unique Identifier for this component/control instance
16+
*/
17+
UUID getComponentID();
18+
}

src/main/java/org/owasp/esapi/core/accesscontrol/AccessController.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.owasp.esapi.core.accesscontrol;
22

3+
import org.owasp.esapi.core.SecurityComponent;
4+
35
/**
46
* The AccessController interface defines a set of methods that can be used in a wide variety of applications to
57
* enforce access control. In most applications, access control must be performed in multiple different locations across
@@ -51,7 +53,7 @@
5153
* @author Jeff Williams ([email protected]) ESAPI v0-1.5
5254
* @author Chris Schmidt ([email protected]) ESAPI v3.0
5355
*/
54-
public interface AccessController {
56+
public interface AccessController extends SecurityComponent {
5557
/**
5658
* Developers should call isAuthorized to control execution flow. For
5759
* example, if you want to decide whether to display a UI widget in the

src/main/java/org/owasp/esapi/core/authentication/Authenticator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.owasp.esapi.core.authentication;
22

3+
import org.owasp.esapi.core.SecurityComponent;
4+
35
/**
46
* The Authenticator interface defines a set of methods for generating and
57
* handling account credentials and session identifiers. The goal of this
@@ -13,6 +15,6 @@
1315
* @author Chris Schmidt ([email protected])
1416
* @since June 1, 2007
1517
*/
16-
public interface Authenticator {
18+
public interface Authenticator extends SecurityComponent {
1719

1820
}

src/main/java/org/owasp/esapi/core/encoding/Encoder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.owasp.esapi.core.encoding;
22

3+
import org.owasp.esapi.core.SecurityComponent;
34
import org.owasp.esapi.core.validation.ValidationException;
45

56
/**
@@ -9,7 +10,7 @@
910
*
1011
* @author Chris Schmidt ([email protected]) http://www.ContrastSecurity.com
1112
*/
12-
public interface Encoder {
13+
public interface Encoder extends SecurityComponent {
1314

1415

1516
/**
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package org.owasp.esapi.core.event;
22

3+
import org.owasp.esapi.core.SecurityComponent;
4+
35
import java.util.EventListener;
46

5-
public interface SecurityEventListener extends EventListener {
7+
public interface SecurityEventListener extends EventListener, SecurityComponent {
68
<T> void onSecurityEvent(SecurityEvent event, T eventContext);
79
}

src/main/java/org/owasp/esapi/core/logging/SecurityLogger.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.owasp.esapi.core.logging;
22

3+
import org.owasp.esapi.core.SecurityComponent;
34
import org.owasp.esapi.core.event.SecurityEvent;
45

56
/**
@@ -14,7 +15,7 @@
1415
* logging event in addition to the event description which can be logged allowing filtering based off of Security Event
1516
* when parsing or reading Security logs.
1617
*/
17-
public interface SecurityLogger {
18+
public interface SecurityLogger extends SecurityComponent {
1819
<T extends SecurityEvent> void audit(T event, String message, Object... parms);
1920
<T extends SecurityEvent> void audit(T event, Throwable t, String message, Object... parms);
2021

src/main/java/org/owasp/esapi/core/validation/Validator.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package org.owasp.esapi.core.validation;
22

3+
import org.owasp.esapi.core.SecurityComponent;
4+
35
/**
46
* The Validator interface defines a set of methods for validating untrusted input. Validators can be
57
* used to validate simple or complex data-types depending on the implementation.
@@ -14,7 +16,7 @@
1416
* @version 3.0
1517
*/
1618
@SuppressWarnings("UnusedDeclaration")
17-
public interface Validator {
19+
public interface Validator extends SecurityComponent {
1820
/**
1921
* Validates the given input and throws a {@link ValidationException} if validation fails.
2022
*

0 commit comments

Comments
 (0)