Skip to content

Commit

Permalink
Update TokenAuthentication.sendAuthRequest()
Browse files Browse the repository at this point in the history
The TokenAuthentication.sendAuthRequest() has been updated
to create PKIClient directly.
  • Loading branch information
edewata committed Jul 23, 2024
1 parent 96a341e commit 460ee37
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@
import com.netscape.certsrv.authentication.EMissingCredential;
import com.netscape.certsrv.base.EBaseException;
import com.netscape.certsrv.base.SessionContext;
import com.netscape.certsrv.client.ClientConfig;
import com.netscape.certsrv.client.PKIClient;
import com.netscape.certsrv.profile.EProfileException;
import com.netscape.certsrv.property.IDescriptor;
import com.netscape.cms.servlet.csadmin.Configurator;
import com.netscape.cms.servlet.csadmin.ConfigCertApprovalCallback;
import com.netscape.cmscore.apps.CMS;
import com.netscape.cmscore.apps.EngineConfig;
import com.netscape.cmscore.base.ConfigStore;
Expand Down Expand Up @@ -196,8 +197,15 @@ private String sendAuthRequest(String authHost, int authPort, String authUrl, Mu
throws Exception {

String serverURL = "https://" + authHost + ":" + authPort;
PKIClient client = Configurator.createClient(serverURL, null, null);
return client.post(authUrl, content, String.class);

ClientConfig config = new ClientConfig();
config.setServerURL(serverURL);

ConfigCertApprovalCallback callback = new ConfigCertApprovalCallback();

try (PKIClient client = new PKIClient(config, null, callback)) {
return client.post(authUrl, content, String.class);
}
}

/**
Expand Down

0 comments on commit 460ee37

Please sign in to comment.