Skip to content

Commit

Permalink
Add RevocationCheckingConfig
Browse files Browse the repository at this point in the history
The RevocationCheckingConfig has been added to encapsulate
auths.revocationChecking.* params.
  • Loading branch information
edewata committed May 4, 2023
1 parent 955856b commit fed16ed
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.dogtagpki.server.authentication.AuthManagerConfig;
import org.dogtagpki.server.authentication.AuthToken;
import org.dogtagpki.server.authentication.AuthenticationConfig;
import org.dogtagpki.server.authentication.RevocationCheckingConfig;
import org.mozilla.jss.netscape.security.x509.X509CertImpl;

import com.netscape.certsrv.authentication.AuthCredentials;
Expand Down Expand Up @@ -71,7 +72,7 @@ public class CertUserDBAuthentication extends AuthManager {
private CertUserLocator mCULocator = null;

private boolean mRevocationCheckingEnabled = false;
private ConfigStore mRevocationChecking;
private RevocationCheckingConfig mRevocationChecking;

public CertUserDBAuthentication() {
}
Expand All @@ -97,14 +98,14 @@ public void init(
mConfig = config;

if (authenticationConfig != null) {
mRevocationChecking = authenticationConfig.getSubStore("revocationChecking", ConfigStore.class);
mRevocationChecking = authenticationConfig.getRevocationCheckingConfig();
}
if (mRevocationChecking != null) {
mRevocationCheckingEnabled = mRevocationChecking.getBoolean("enabled", false);
mRevocationCheckingEnabled = mRevocationChecking.isEnabled();
if (mRevocationCheckingEnabled) {
int size = mRevocationChecking.getInteger("bufferSize", 0);
long interval = mRevocationChecking.getInteger("validityInterval", 28800);
long unknownStateInterval = mRevocationChecking.getInteger("unknownStateInterval", 1800);
int size = mRevocationChecking.getBufferSize();
long interval = mRevocationChecking.getValidityInterval();
long unknownStateInterval = mRevocationChecking.getUnknownStateInterval();

if (size > 0)
engine.setListOfVerifiedCerts(size, interval, unknownStateInterval);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,11 @@ public AuthenticationConfig(String name, SimpleProperties source) {
public AuthManagersConfig getAuthManagersConfig() {
return getSubStore("instance", AuthManagersConfig.class);
}

/**
* Returns auths.revocationChecking.* parameters.
*/
public RevocationCheckingConfig getRevocationCheckingConfig() {
return getSubStore("revocationChecking", RevocationCheckingConfig.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// Copyright Red Hat, Inc.
//
// SPDX-License-Identifier: GPL-2.0-or-later
//
package org.dogtagpki.server.authentication;

import com.netscape.certsrv.base.EBaseException;
import com.netscape.cmscore.base.ConfigStorage;
import com.netscape.cmscore.base.ConfigStore;
import com.netscape.cmscore.base.SimpleProperties;

/**
* Provides auths.revocationChecking.* parameters.
*/
public class RevocationCheckingConfig extends ConfigStore {

public RevocationCheckingConfig(ConfigStorage storage) {
super(storage);
}

public RevocationCheckingConfig(String name, SimpleProperties source) {
super(name, source);
}

/**
* Returns auths.revocationChecking.enabled parameter.
*/
public boolean isEnabled() throws EBaseException {
return getBoolean("enabled", false);
}

/**
* Returns auths.revocationChecking.bufferSize parameter.
*/
public int getBufferSize() throws EBaseException {
return getInteger("bufferSize", 0);
}

/**
* Returns auths.revocationChecking.validityInterval parameter.
*/
public int getValidityInterval() throws EBaseException {
return getInteger("validityInterval", 28800);
}

/**
* Returns auths.revocationChecking.unknownStateInterval parameter.
*/
public int getUnknownStateInterval() throws EBaseException {
return getInteger("unknownStateInterval", 1800);
}
}

0 comments on commit fed16ed

Please sign in to comment.