Question & Answer
Question
How do I change the URL a browser is redirected to after authentication from a mapping rule?
Answer
Use the itfim_override_targeturl_attr attribute in your mapping rule. The attribute is added to the output stsuuser.
Partial JavaScript snippets:
Partial JavaScript snippets:
Setting a static target URL:
Setting the value based on an attribute in the input token called ApplicationIdURL. A static value is set when the input token attribute is not found or empty:
var targetUrl = new java.lang.String("http://www.example.com/");
var targetUrlAttr = new Attribute("itfim_override_targeturl_attr", "urn:ibm:names:ITFIM:5.1:accessmanager", targetUrl);
stsuu.addAttribute(targetUrlAttr);
Setting the value based on an attribute in the input token called ApplicationIdURL. A static value is set when the input token attribute is not found or empty:
var targetUrl = new java.lang.String("http://SP/CommonLandingPage/");
var vals = stsuu.getAttributeContainer().getAttributeValuesByName("
ApplicationIdURL");
if (vals != null && vals.length > 0) {
targetUrl= vals;
}
var targetUrlAttr = new Attribute("itfim_override_targeturl_attr", "urn:ibm:names:ITFIM:5.1:accessmanager", targetUrl);
stsuu.addAttribute(targetUrlAttr);
A combined SP check to change the target when the user clicked an old link:
var claims = stsuu.getRequestSecurityToken().getAttributeByName("Claims").getNodeValues();
for (var i = 0; i < claims.length; i++) {
var dialect = claims[i].getAttribute("Dialect");
var dialect = claims[i].getAttribute("Dialect");
if ("urn:ibm:names:ITFIM:saml".equalsIgnoreCase(dialect)) {
var samlclaims = claims[i].getElementsByTagName("fimc:Saml20Claims");
var samlclaims = claims[i].getElementsByTagName("fimc:Saml20Claims");
if (samlclaims != null) {
var samlclaim = samlclaims.item(0);
var relayState = samlclaim.getAttribute("RelayState");
IDMappingExtUtils.traceString("relayState : " + relayState);
if (relayState = "https://SP/OldLandingPage") {
var targetUrlAttr = new Attribute("itfim_override_targeturl_attr", "urn:ibm:names:ITFIM:5.1:accessmanager", "https://SP/NewLandingPage/");
stsuu.addAttribute(targetUrlAttr);
}
}
}
}
var samlclaim = samlclaims.item(0);
var relayState = samlclaim.getAttribute("RelayState");
IDMappingExtUtils.traceString("relayState : " + relayState);
if (relayState = "https://SP/OldLandingPage") {
var targetUrlAttr = new Attribute("itfim_override_targeturl_attr", "urn:ibm:names:ITFIM:5.1:accessmanager", "https://SP/NewLandingPage/");
stsuu.addAttribute(targetUrlAttr);
}
}
}
}
[{"Product":{"code":"SSZSXU","label":"Tivoli Federated Identity Manager"},"Business Unit":{"code":"BU008","label":"Security"},"Component":"SSO","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB24","label":"Security Software"}},{"Product":{"code":"SSZU8Q","label":"IBM Security Access Manager"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB24","label":"Security Software"}},{"Product":{"code":"SSELE6","label":"IBM Security Access Manager for Mobile"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB24","label":"Security Software"}},{"Product":{"code":"SSPREK","label":"Tivoli Access Manager for e-business"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB24","label":"Security Software"}},{"Type":"MASTER","Line of Business":{"code":"LOB24","label":"Security Software"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSRGTL","label":"IBM Security Verify Access"},"ARM Category":[{"code":"a8m0z000000cxugAAA","label":"Security Verify Access-\u003EFederation"}],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions"}]
Was this topic helpful?
Document Information
Modified date:
22 November 2022
UID
swg21676244