Multifactor Authentication Redirect

erichheard
Giga Contributor

Hello all,

        We have a single page app hosted on a ServiceNow instance and the customer wants to implement multi-factor authentication.   Thanks to the documentation, I was able to set it up quite easily and I have tested it out and it is working just fine.   I do have one issue, however, and that is the redirect after a user sets up their MFA account, scans the barcode with the Google Authenticator app and enters the code on initial login.   The MFA page (UI Page "google_auth_setup_page") redirects to the ServiceNow home page.   I need to change this to redirect to our single page app's homepage and I can't find a way to do this.   There are users in our app that should absolutely NOT have access to ServiceNow itself.   It appears that google_auth_setup_page submits a form to ui_page_process.do which is backed by the Java class com.glide.ui_page.UIPageProcessor.   I have tried adding a global UI Script to handle the redirect on the front end, but it seems that the target of UIPageProcessor is either not loading these scripts or, perhaps more likely, is performing the redirect by returning a 302.   The best result I have gotten was to have our app displayed, but in the ServiceNow interface with the top and left frames still available.   Here is workflow as it is now:

* User logs in to our single page app for the first time

* User is forwarded to the change your password form

* User is forwarded to the MFA setup form

* User is redirected to ServiceNow (either /navpage.do or /nav_to.do)

And this is the workflow we'd like:

* User logs in to our single page app for the first time

* User is forwarded to the change your password form

* User is forwarded to the MFA setup form

* User is redirected to our single page app

Any ideas on how to make this happen?

1 ACCEPTED SOLUTION

erichheard
Giga Contributor

I think I got this figured out.   I added the following lines of code at line 7 of this UI Page's processing script (Istanbul version of the script - it may be different for other versions):



var urlOnStack = GlideSession.get().getStack().bottom();
response.sendRedirect(urlOnStack);


and it appears to be redirecting where I want it to.


View solution in original post

2 REPLIES 2

erichheard
Giga Contributor

I think I got this figured out.   I added the following lines of code at line 7 of this UI Page's processing script (Istanbul version of the script - it may be different for other versions):



var urlOnStack = GlideSession.get().getStack().bottom();
response.sendRedirect(urlOnStack);


and it appears to be redirecting where I want it to.


Hello Erich, You conveyed you have added the code to line 7 of the UI page Processing script. Are you referring to ui Page "google_auth_setup_page" ?