Posted: 17 Nov 2020 10:01 EST Last activity: 23 Nov 2020 8:26 EST
How to authenticate a user in custom authentication activityll,
In my application the user is authenticated by an external system. Once successfully authenticated, the request is routed to the Pega application (hosted on Tomcat). In pega application we need to capture the user-Id from the http request header and authenticate the user.
I used a PRCustom servlet and created an authentication service rule. I also created an authentication activity. I could capture the user-Id from the http header using a simple java code in Param.UserId
In the next step I did Obj-Open on the operator Id. The page name is 'OperatorPage'.
Next step is Java - "tools.getParameterPage().putObject("pyOperPage", myStepPage); "
*Note Step Page is 'OperatorPage' in the Java step.
All these steps run fine. No errors observed during debug in logs.
At this point I expect the user should get authenticated and presented with their default portal. However, I get the Error screen saying "Operator is unauthenticated or unavailable".
Looks ok based on what you've written, you're definitely on the right track. Some other examples I've looked at suggest your Java step can be just
... but this probably just wraps the same Java code as yours. I don't expect that is the issue, but might be worth a try.
At this point I'd recommend using Log-Message steps in your Activity to confirm that you've extracted the HTTP header correctly and that you've successfully loaded the Operator-ID instance into OperatorPage. An absence of errors from the logs doesn't mean it's doing what you expect - have log messages prove that it is.
Also if you are delegating to an inner Activity from your Authentication Activity to do the "work", ensure that you tick "Pass current parameter page" when calling it, otherwise the outcome of your Java step doesn't make it back to the calling activity, and therefore not back to the Engine that needs to know what Operator page to use for the session.
Solution: We are required to add another step to open the authentication service rule inside the activity. Say step1 of the activity. Please refer to LDAP authentication activities for reference. They do the same thing using a JAVA code.