Redirect users back to login (SSO) page after logout then back to specific page depending on role(s)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2015 05:15 AM
We are wanting to redirect users back to the login page (ADFS Single Sign-On) after they have logged off either the ESS portal or the normal ITIL portal (? - instancename.service-now.com/) then once they have logged back on depending on their role or lack of role direct them to either the ESS portal (for non-roled users) or to the ITIL portal for ITIL roled users.
So far I created a new external_logout_complete page (under the UI pages) with a redirect to the login page using location.href = 'nav_to.do?uri= and works a treat.
We have code before the redirect (below) to detect if the user has or hasn't a role and that works before the user hits the logout button by running /external_logout_complete.do
However once you logout, the ADFS has killed the session and technically no user is logged in so it always returns back to the ESS portal.
Is there away to either get if the user had a role before they logged off? or will we have to create a UI script for when they log-on and re-direct them then? - which will fix another issue that management want fixed is non-roled users accessing the ITIL portal....
Thanks in-advance
Matt
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="true" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_userrec" object="false">
// var roled_user = true;
var user = gs.getUser();
if( !user.hasRoles()) {
roled_user = false;
}else{
roled_user = true;
}
roled_user;
</g:evaluate>
<script>
if(${jvar_userrec} ) {
setTimeout("location.href = 'nav_to.do?uri=';",5000);
}else{
setTimeout("location.href = '../saml_redirector.do?sysparm_uri=/ess';",5000);
}
</script>
<table class="wide" cellpadding="0" cellspacing="0" border="0">
<tr class="header">
<td>
<table border="0" cellspacing="0" cellpadding="2">
<tr class="header">
<td width="100%">
<div id="form_header" class="caption" style="margin-top: 2px;">${gs.getMessage('Logout succeeded')}</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<div>
<h3>${gs.getMessage('Logout successful')}</h3>
</div>
</td>
</tr>
<tr>
<td>
<div>
${gs.getMessage('You have successfully logged out.')} <br/>
You will be redirected back to the login page in 5 seconds.
</div>
</td>
</tr>
</table>
</j:jelly>

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2015 07:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2015 04:23 PM
Hi Pradeep,
Thanks for the reply and the link, very helpful.
Thought that was the way that we had to go that way.
Once again, thanks
Matt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2015 09:46 PM
Hi Matthew,
Thanks for the update.
Would you mind marking my response and close the loop if the issue is resolved.