In out application we need to ensure that User logs in by clicking on a link that he received via email.
This URL should have an extra parameter say "User_Key" .
When the user clicks on this link he is is routed to the Pega Login page .He has to enter his credentials and click on log in. On log in I need to compare the User Key with a value stored in Pega Data.
I Customized the IAC Authentication Service to call an activity which extracts this values.
However in the activity I cannot retrieve the value of User_Key when user clicks on login (even though User_key) exists in the URL.
I can get the value of User_Key if I refresh the link but not on click of Log In Button.
The first time the login activity runs you have it configured to display the login screen. Unless you use the pyQueryString parameter to map to the clipboard and then add them to the login screen the parameters will get dropped. When the user fills in thier user credential and hits submit the activity is run again but your parameters are no longer there.
With PRCustom authentication there is a pyQueryString parameter that contains all the parameters. This needs to get mapped to the clipboard on the first execution of the activity where the parameters were sent in.
The sample configuration I have outlined below is going to make sure the login screen always submits the initial query string as well. You can follow this if you want or modify for your needs. For example you could just to step 3 and 4. The general idea is you need to capture the initial query string content for later use as the login activity runs multiple times.
Copy Web-Login - Rename to WebLoginSSO. (Make sure this is in a RuleSet that is available to unautheticated users, same ruleset where you have your activity customizations will work)
Update you authentication service, custom tab, reference WebLoginSSO as the Credential Challenge Stream.
Add new property to Code-Pega-Thread.SSOSnapStartQuery. (Unauthenticated RuleSet)
Update your login activity and set the SSOSnapStartQuery property to the param.pyQueryString. You do this at the bottom of the activity before you direct to display the login screen the first time the activity is run.
Update the WebLoginSSO and mapp the SSOSnapStartQuery into the form element action attribute. Bold/Italic is the code changes.
With regards to saving the parameter value to the DB during login. You have to give permissions within the AccessGroup used for unauthenticated users to be able to save the the PRPC class. So, you need to define a standard role that will give permission to save to the class and make sure it's defined in the AccessGroup for the unauthenticated users.
Note: You just have to issue a Obj-Save. The commit will occur at the engine level once operator verification has completed as the system is updating and commiting the operator record.
Hi - Thank you for the help. I am able to get the URL parameter in the Login Activity now. I still could not save the Data Page while in the activity . It could be a problem with modifying the access groups incorrectly .
I am still not able to save the parameter in the activity using an OBJ-SAVE. I had raised another question for it , the data page I need to save belongs in the application rulest. (Say , MyAPP-FW 1.0.0 )
While doing a custom authentication I am setting the operator an access group which provides access to MyApp-FW
However still Pega gives me an error in the logs stating "
You are not authorized to save instance MyApp-FW ...."
I would like to also know if there is another way of doing this after login but before user gets the pega home page.