Question

2
Replies
77
Views
MichaelB9860 Member since 2018 8 posts
Segue Technologies Inc
Posted: 9 months ago
Last activity: 9 months 3 weeks ago

Read HTTPHeaderRequest

We are trying to capture the users unique identifier so that we can log the user into the application as the X509 certificate's unique ID (ten digit number).

We have configured Tomcat with a secure key store and trust store where the system prompts for the user's certificate and PIN. The browser passes the attributes to the application in the HTTPHeaderRequest; however, I cannot get the Pega code to read the http header request object.We have the following java code in our authentication activity (called from /PRWebLDAP1).

The output from the code below is the following:

111
222
444
Request is not null
Request = com.pega.pegarules.priv.authentication.RequestFacade@4fc53f6a
ERROR: Calling x509 certificate ... Attributes not available in the ETier
333

It appears to bomb on "request.getRemoteUser()". How can I get information from the request object?

//java.security.cert.X509Certificate.X509Certificate[] certs = null;
System.out.println(" 111 ");
javax.servlet.http.HttpServletRequest request = (javax.servlet.http.HttpServletRequest)tools.getRequestor().getRequestorPage().getObject("pxHTTPServletRequest");
try {
	System.out.println(" 222 ");
	java.lang.Object objCertificates = null;
	java.lang.Object objCertificates2 = null;
	System.out.println(" 444 ");
  if (request != null) {
    System.out.println("Request is not null");
    System.out.println("Request = " + request);
    System.out.println("Request.getRemoteUser() = " + request.getRemoteUser());
  } else {
    System.out.println("Request IS null");
  }
  objCertificates2 = request.getAttributeNames();
	System.out.println(" 555 ");
	System.out.println(" 555 attributes = " + objCertificates2);
  objCertificates = request.getAttribute("javax.servlet.request.X509Certificate");
	System.out.println(" 666 ");
//	certs = (X509Certificate[])objCertificates;
	System.out.println("We are able to read the javax.servlet.request.X509Certificate");
} catch (Exception e) {
	System.out.println("ERROR: Calling x509 certificate ... " + e.getMessage());
}
Data Integration Java and Activities
Share this page LinkedIn