Question
Bradesco Seguros
BR
Last activity: 14 Aug 2017 9:47 EDT
How to retrieve cookie information outside of authentication activity?
We are facing a problem in the project and would like to get some kind of solution with you. We have an authentication activity, where we create a step where it retrieves the token, through the verification of the cookie, as below:
Javax.servlet.http.HttpServletRequest req = null;
Try {
Req = (javax.servlet.http.HttpServletRequest) tools.getRequestor (). GetRequestorPage (). GetObject ("pxHTTPServletRequest");
If (req.getMethod () == null)
{
String errorMessage = "User Principal not passed to PEGA, Please contact System Administrator";
Tools.putParamValue ("Status", "fail");
Tools.putParamValue ("errMsg", errorMessage);
Tools.putParamValue ("pyChallenge", errorMessage);
Throw new PRRuntimeException (errorMessage);
}
Javax.servlet.http.Cookie [] cookies = req.getCookies ();
String token = null;
If (cookies! = Null) {
For (int i = 0; i <cookies.length; i ++) {
//oLog.infoForced("cookie ---> "+ cookies [i] .getName ());
If (cookies [i] .getName () .equals ("LtpaToken2"))
Token = cookies [i] .getValue ();
}
}
Tools.putParamValue ("LTPA", token);
} Catch (Exception e)
{
Throw new PRRuntimeException ("Exception:" + e.getMessage ());
}
This works perfectly when we call directly from our host in the PEGA domain.
We are facing a problem in the project and would like to get some kind of solution with you. We have an authentication activity, where we create a step where it retrieves the token, through the verification of the cookie, as below:
Javax.servlet.http.HttpServletRequest req = null;
Try {
Req = (javax.servlet.http.HttpServletRequest) tools.getRequestor (). GetRequestorPage (). GetObject ("pxHTTPServletRequest");
If (req.getMethod () == null)
{
String errorMessage = "User Principal not passed to PEGA, Please contact System Administrator";
Tools.putParamValue ("Status", "fail");
Tools.putParamValue ("errMsg", errorMessage);
Tools.putParamValue ("pyChallenge", errorMessage);
Throw new PRRuntimeException (errorMessage);
}
Javax.servlet.http.Cookie [] cookies = req.getCookies ();
String token = null;
If (cookies! = Null) {
For (int i = 0; i <cookies.length; i ++) {
//oLog.infoForced("cookie ---> "+ cookies [i] .getName ());
If (cookies [i] .getName () .equals ("LtpaToken2"))
Token = cookies [i] .getValue ();
}
}
Tools.putParamValue ("LTPA", token);
} Catch (Exception e)
{
Throw new PRRuntimeException ("Exception:" + e.getMessage ());
}
This works perfectly when we call directly from our host in the PEGA domain.
However the client decided to use SPNEGO and when the call is made by him, this java routine of the authentication activity can not get the Token.
We decided to choose to create a new activity after the authentication activity that will be from time to time, trying to get the cookie information. Unfortunately, however, PEGA has a limitation, where the pxHTTPServletRequest property is only started at the time of authentication and we are unable to retrieve the information at a later time.
Is there any way in PEGA, after authenticating that through a JAVA code or another routine, is it possible to pick up the request information again and get the necessary cookies?
Is there another way to use javax.servlet.http.HttpServletRequest without being encoded below:
(Javax.servlet.http.HttpServletRequest) tools.getRequestor (). GetRequestorPage (). GetObject ("pxHTTPServletRequest");
Is it possible to give a getHearder for example?
Please, I'm really in need of some help to clarify which path I can use.
***6/12/17 Edited by moderator, Maryrita: moved to Product Support from Lead System Architects***