diff options
Diffstat (limited to 'base/common/src')
-rw-r--r-- | base/common/src/com/netscape/certsrv/logging/event/CertRequestProcessedEvent.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/base/common/src/com/netscape/certsrv/logging/event/CertRequestProcessedEvent.java b/base/common/src/com/netscape/certsrv/logging/event/CertRequestProcessedEvent.java index 3e5041ddf..777434bd7 100644 --- a/base/common/src/com/netscape/certsrv/logging/event/CertRequestProcessedEvent.java +++ b/base/common/src/com/netscape/certsrv/logging/event/CertRequestProcessedEvent.java @@ -21,6 +21,7 @@ import java.security.cert.CertificateEncodingException; import com.netscape.certsrv.logging.AuditEvent; import com.netscape.certsrv.logging.ILogger; +import com.netscape.certsrv.request.IRequest; import com.netscape.cmsutil.util.Utils; import netscape.security.x509.X509CertImpl; @@ -29,6 +30,8 @@ public class CertRequestProcessedEvent extends AuditEvent { private static final long serialVersionUID = 1L; + public final static String SIGNED_AUDIT_CERT_REQUEST_REASON = "requestNotes"; + public CertRequestProcessedEvent( String subjectID, String outcome, @@ -65,6 +68,24 @@ public class CertRequestProcessedEvent extends AuditEvent { }); } + public CertRequestProcessedEvent( + String subjectID, + String outcome, + String requesterID, + String infoName, + IRequest request) { + + super(CERT_REQUEST_PROCESSED); + + setParameters(new Object[] { + subjectID, + outcome, + requesterID, + infoName, + auditInfoValue(request) + }); + } + /** * Signed Audit Log Info Certificate Value * @@ -111,4 +132,36 @@ public class CertRequestProcessedEvent extends AuditEvent { return ILogger.SIGNED_AUDIT_EMPTY_VALUE; } } + + /** + * Signed Audit Log Info Value + * + * This method is called to obtain the "reason" for + * a signed audit log message. + * <P> + * + * @param request the actual request + * @return reason string containing the signed audit log message reason + */ + String auditInfoValue(IRequest request) { + + String reason = ILogger.SIGNED_AUDIT_EMPTY_VALUE; + + if (request != null) { + // overwrite "reason" if and only if "info" != null + String info = + request.getExtDataInString(SIGNED_AUDIT_CERT_REQUEST_REASON); + + if (info != null) { + reason = info.trim(); + + // overwrite "reason" if and only if "reason" is empty + if (reason.equals("")) { + reason = ILogger.SIGNED_AUDIT_EMPTY_VALUE; + } + } + } + + return reason; + } } |