Hello Rahil,
Yes, I strongly recommend you raise an RFE (Request For Enhancement) with the ISAM Development team, to suggest implementing the possibility do to URI encoding in HTTP transformation rules.
https://www.ibm.com/support/pages/ibm-security-access-manager-web-request-enhancementsI think at this point we've exhausted most routes to a solution...
Do you have any component in your network that sits in front of the WebSEAL / Reverse Proxy servers? Some load balancer where (where you terminate SSL) and that can rewrite headers for you?
I'm including an example of how you might want to try that using the FELB (Front End Load Balancer) on an ISAM appliance. (although I understand this would have implications on overall network topology)
So assuming you can terminate SSL at your load-balancer, you can use that to rewrite the location header. In the case of the FELB on ISAM, you can set an advanced tuning parameter rspirep (
https://www.haproxy.com/documentation/aloha/10-0/traffic-management/lb-layer7/http-rewrite/):
Where your value for the rspirep parameter could be something like this:
^Location:\ https:\/\/www.myidp.ibm.com\/isam\/sps\/saml20idp\/saml20\/login\?SAMLRequest=([0-9A-Z%?.=&-]*) Location:\ https:\/\/www.myidp.ibm.com\/isam\/sps\/saml20idp\/saml20\/login\?SAMLRequest=\1\&lang\=ar
I'm not that familiar with regex, so there might be a cleaner way to achieve this.... but the ([0-9A-Z%?.=&-]*) capture group could be used to match on the location header dynamic data (the SAML authentication request), and use that to build a new header, using \1 to print the capture group. And use \&lang\=ar to append your required lang parameter.
Most likely other Load Balancers have similar features... so you might want to check that with your LB team.
Hope this provides you with some ideas or alternatives to still implement your requirement?
------------------------------
HANS VANDEWEGHE
------------------------------
Original Message:
Sent: Tue December 31, 2019 03:01 AM
From: Rahil Anwar
Subject: Sending lang=ar in HTTP Request to IDP
Hi Hans,
Thanks for your detailed response. We tried the SAML Post option provided and its still no use. We checked with IDP team and they do not support HTTP-Post . Only HTTP-Redirect
Seems the only option left is HTTP Transformation and add the lang=ar parameter in HTTP request as IDP expecting. And we have Limitation from our end in uri encoding.
Sad ending ;)
Thanks,
Rahil
------------------------------
Rahil Anwar
------------------------------
Original Message:
Sent: Fri December 27, 2019 06:19 AM
From: HANS VANDEWEGHE
Subject: Sending lang=ar in HTTP Request to IDP
Hi Rahil,
My 2 cents (... in addition to the other cents given in the Support case ;-) ... )
So it turns out that HTTP Transformation Rules are losing URI encoding. I believe there is currently an open RFE (Request for Enhancement) with the ISAM Dev team to introduce the possibility to have URI encoding capabilities in Transformation Rules.
I suggest you also raise this as an RFE for your company. (this always helps with RFE prioritisation discussions)
The reason why your IDP is rejecting the authentication request is (very likely) related to the change of the Partner definition, where you appended the ?lang=ar query string.
Decoding your SAML Authentication request, shows indeed where I think the problem is:
<samlp:AuthnRequest xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" AssertionConsumerServiceURL="https://eservtest.mcs.gov.sa/isam/sps/mcssp/saml20/login" Destination="https://www.iam.sa/samlsso?lang=ar" ForceAuthn="false" ID="FIMREQ_d82bf15-016f-14fd-b96b-81129b9ee2f0" IsPassive="false" IssueInstant="2019-12-16T07:01:10Z" ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Version="2.0">
The IDP likely does not expect Destination="https://www.iam.sa/samlsso?lang=ar"
Manually changing this via HTTP Transformation Rules will likely result in 2 issues:
(1) The signed message will not match
(2) Again the problem of the URI encoding in HTTP Transformation Rules.
Reading again your explanation of what the IDP expects:
The language consistency will be maintained during the authentication. "lang" HTTP attribute will be sent from the service provider to IAM as part of the Authentication Request (as additional parameter). The SAML2 response is sent from IAM back to the service provider including the "lang" as SAML2 attribute.
I believe your IDP also supports SAML HTTP Post binding is also a possible integration pattern for them? (maybe needs to be agreed as part of the onboarding or registration process...)
Protocol: SAML 2 Web SSO Profile: with the following bindings:
• Request: urn:oasis:names:tc:SAML:2.0:bindings:HTTP-REDIRECT or
urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST.
• Response: urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST
I believe this binding type might be easier to work with HTTP Transformation rules (since we don't need to modify the SAML AuthnRequest or other URI data where encoding is expected ... presumably.. ;-)
Perhaps you could modify the action URL from the self-posting SAML form, to append the ?lang=ar query string. (of maybe using javascript you could add more logic to also distinguish between EN and AR)
Including here an example of how you can try this approach.
Lastly, but I believe you have already tried adding that (at least saw it in your decoded SAML Authrequest). The (imho) correct way to meet this language consistency requirement, would be to pass this as part of the SAML:AuthnRequest content itself. (so not as a query string parameter). This can be done via SAML Message Extensions.

This of-course does require an IDP to be able to process this.
/*
* This mapping rule is a special-purpose rule for injecting samlp:Extension elements into a SAMLMessage.
*
* Some SAML federation partners (particularly government-run or industry-specific require the use of these custom
* extensions to relay additional data about a federation relationship or runtime parameter.
* These extensions are all defined by the SAML specification.
*
* This example mapping rule shows how you can populate some locale information into the AuthnRequest as an extension.
*
* What we get as "input" in this mapping rule is a context. The context contains a bunch of information about
* the current message that we can use to decide whether or not to even add extensions, and also use to determine
* what extensions or values to add. For example we could use the value of a HTTP header from the current request
* to select what language to ask the IDP to present a login form in.
*
* The "output" from the mapping rule is XML nodes populated into the output variable "extension_properties". This begins
* as an empty java.util.List, and we populate it with one or more org.w3c.dom.Node objects.
*/
importClass(Packages.com.tivoli.am.fim.trustserver.sts.utilities.IDMappingExtUtils);
/**
* This is really a debug/discovery function that logs everything we are allowed to get access to about
* the current message. We could use any of this information to decide whether or not to add any
* samlp:Extensions, and influence what those extensions might be.
*/
function logAvailableContext() {
var str = 'logAvailableContext';
// url
str += "\n Request URL: " + context.getUrl();
// headers
var headerList = context.getHeaderNames();
for (var i = headerList.iterator(); i.hasNext(); ) {
var n = i.next();
var v = context.getHeader(n);
str += "\n Header with name: " + n + " value: " + v;
}
// parameters
var paramList = context.getParameterNames();
for (var i = paramList.iterator(); i.hasNext(); ) {
var n = i.next();
var v = context.getParameter(n);
str += "\n Parameter with name: " + n + " value: " + v;
}
// now the message "Info" keys and their values
var keyList = context.getInfoKeys();
for (var i = keyList.iterator(); i.hasNext(); ) {
var n = i.next();
var v = context.getInfoValue(n);
str += "\n Info element with key: " + n + " value: " + v;
}
IDMappingExtUtils.traceString(str);
}
/**
* This function builds the list of nodes that are to go within the samlp:Extensions object of a message.
* You could do this based on information available in the request, or statically. Have a look at the output
* of logAvailableContext to get an idea of what you can see and make decisions about.
*
* @returns nothing, but extension_properties will be updated with the nodes we want to add as children of
* samlp:Extensions.
*/
function buildSAMLExtensions() {
var d = IDMappingExtUtils.newXMLDocument();
var e = d.createElementNS("request", "lang");
e.setTextContent("ar");
extension_properties.add(e);
}
/**
* This function returns true if this execution of the mapping rule should add samlp:Extensions nodes.
* In the case of this example, we do that on any AuthnRequest.
* @returns
*/
function shouldAddExtensions() {
var msgType = context.getInfoValue("MsgType");
return (msgType != null && msgType.equals("AuthnRequest"));
}
// main logic starts here
var debug = false;
if (debug) {
// To see this debug ensure you have the following trace component enabled:
// com.tivoli.am.fim.trustserver.sts.utilities.*=ALL
//
// To see how to enable trace on ISAM see:
// https://www.ibm.com/support/knowledgecenter/en/SSPREK_9.0.5/com.ibm.isam.doc/config/task/tsk_runtime_tuning.html
logAvailableContext();
}
if (shouldAddExtensions()) {
buildSAMLExtensions();
}

Hope it helps.
Hans
------------------------------
HANS VANDEWEGHE
Original Message:
Sent: Thu December 26, 2019 07:49 AM
From: Rahil Anwar
Subject: Sending lang=ar in HTTP Request to IDP
Hi Jon,
We had a discussion with IDP and got from them that the &lang=ar need not to be at end of the URL. It can be anywhere. In this case also we will end up in uri-encoding.
I got an idea, i.e. from below scenario which worked to some extend
While we define the IDP as partner in ISAM SP under SAML Partner definition --> Single Sign On Setting section appended ?lang=ar
binding : redirect
URL: https://idp/samlsso?lang=ar
IDP Is displaying the login page in arabic -->User enters creds --> But users destination/target app is not displayed. Checked with IDP team and understood IDP is rejecting. The lang=ar should be at the end of the destination url.
From SAML Tracer below non working (Where ISAM is SP) case SAML Req
https://idp/samlsso?lang=ar&SAMLRequest=lZNdb5swFIb%2FCvI9H0Zr1ljARJtWi9RuLEl7sZvKwCG1ZGzmY5L239cmW5PuItPu0OE55%2F2QnCHv5cDK0T6rFfwaAW3w0kuFzP%2FIyWgU0xwFMsV7QGYbti7v71gaJYwjgrFCK3KyMpzfGYy2utGSBOWf7WutcOzBrMHsRAMPq7ucPFs7IItjcMzOOlNR32C01bsIeSycTowDxm6GQ%2BxV0ySWeiuck4WDheL%2B8PHMfr%2BPBO%2F9sqcR9RfJ1TbnhgS32jQw5c9JxyUCCZaLnNwu71c3P57ay7Tu6EWY0FkX0k9dG9bzWR1eUprO6zlA2iWOx8p1IXZwvIA4wlKh5crmJE3oPKRpSGeb5DNLKKPJTxJUv6u4EqoVzszZ3uoDhOzrZlOF1ff1hgSPYHCK6QBSZD4Zm4SND9Vze%2F6kn4g27CaUgbLCvpLi%2F5vP4hPlg42B3bxYUN4dFpmvuuAmi6ePA%2F6ROEy%2BOUPLRaWlaF6DUkq9vzbA7bHVf6WiEf07Vc%2BFLNvWACJ5lz4Veh%2BePoHiDQ%3D%3D&RelayState=uuidd82bf12-016f-1d78-80d2-81129b9ee2f0&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=mfdCzKjw7idVkYHnFGAZWIfnncaXGnneOBe%2FURbRS9fSAyoBu5BuGhEI%2FVIv1nk2bMetXhxEZwev2H3QXpkX55V9ChWEWt1TrpwVVC3d3sdXqZAUU65tmBDhyZTgZKRjBd0u6vOPHbLgz36YkeKkOf5ElyjY%2F4Dg2jtorYdMAVJ%2BT3YxzhDPyQcIcvCZXnRqab8aaJ9DydppNBaGOT997K%2FrLZAFaay%2B39UQWkwgyYlItQ6jJQend8Vz%2B3yyt2vcR8jEeB%2FNkn480uQYIpFgrtaO%2BAqehruA2RaOsDmzLSRWP5Zpj%2B71Fg5xI515usydXqDhnLL3q6q%2Bb6RVEhys8g%3D%3D
From above ; IDP is looking for destination url https://idp/samlsso only. Can we remove lang=ar after user is displayed the Arabic login page and authentication and ISAM send Response to
https://idp/samlsso?lang=ar&SAMLRequest=lZNdb5
Can we remove ?lang=ar and send to IDP so that it can trust and allow
------------------------------
Rahil Anwar
Original Message:
Sent: Mon December 16, 2019 02:23 AM
From: Rahil Anwar
Subject: Sending lang=ar in HTTP Request to IDP
Hi Jon,
Good morning,
I have an update. Tried to insert/send the lang using SAML Extension still users are getting Login page in English. mean, IDP is not designed or ready to accept in SAML Authentication Request.
The remaining two ways either Query or HTTP Header.
I tried below
While we define the IDP as partner in ISAM SP under SAML Partner definition --> Single Sign On Setting section appended ?lang=ar
binding : redirect
URL: https://idp/samlsso?lang=ar
IDP Is displaying the login page in arabic -->User enters creds --> But users destination/target app is not displayed. Checked with IDP team and understood IDP is rejecting. The lang=ar should be at the end of the destination url.
From SAML Tracer below non working (Where ISAM is SP) case SAML Req
https://idp/samlsso?lang=ar&SAMLRequest=lZNdb5swFIb%2FCvI9H0Zr1ljARJtWi9RuLEl7sZvKwCG1ZGzmY5L239cmW5PuItPu0OE55%2F2QnCHv5cDK0T6rFfwaAW3w0kuFzP%2FIyWgU0xwFMsV7QGYbti7v71gaJYwjgrFCK3KyMpzfGYy2utGSBOWf7WutcOzBrMHsRAMPq7ucPFs7IItjcMzOOlNR32C01bsIeSycTowDxm6GQ%2BxV0ySWeiuck4WDheL%2B8PHMfr%2BPBO%2F9sqcR9RfJ1TbnhgS32jQw5c9JxyUCCZaLnNwu71c3P57ay7Tu6EWY0FkX0k9dG9bzWR1eUprO6zlA2iWOx8p1IXZwvIA4wlKh5crmJE3oPKRpSGeb5DNLKKPJTxJUv6u4EqoVzszZ3uoDhOzrZlOF1ff1hgSPYHCK6QBSZD4Zm4SND9Vze%2F6kn4g27CaUgbLCvpLi%2F5vP4hPlg42B3bxYUN4dFpmvuuAmi6ePA%2F6ROEy%2BOUPLRaWlaF6DUkq9vzbA7bHVf6WiEf07Vc%2BFLNvWACJ5lz4Veh%2BePoHiDQ%3D%3D&RelayState=uuidd82bf12-016f-1d78-80d2-81129b9ee2f0&SigAlg=http%3A%2F%2Fwww.w3.org%2F2001%2F04%2Fxmldsig-more%23rsa-sha256&Signature=mfdCzKjw7idVkYHnFGAZWIfnncaXGnneOBe%2FURbRS9fSAyoBu5BuGhEI%2FVIv1nk2bMetXhxEZwev2H3QXpkX55V9ChWEWt1TrpwVVC3d3sdXqZAUU65tmBDhyZTgZKRjBd0u6vOPHbLgz36YkeKkOf5ElyjY%2F4Dg2jtorYdMAVJ%2BT3YxzhDPyQcIcvCZXnRqab8aaJ9DydppNBaGOT997K%2FrLZAFaay%2B39UQWkwgyYlItQ6jJQend8Vz%2B3yyt2vcR8jEeB%2FNkn480uQYIpFgrtaO%2BAqehruA2RaOsDmzLSRWP5Zpj%2B71Fg5xI515usydXqDhnLL3q6q%2Bb6RVEhys8g%3D%3D
Spoke with IDP team by taking a reference of working case (other SP) and understood the way they want is to lang=ar should be appending at last as in below from working SP
https://idp/samlsso?SAMLRequest=fVLbSgMxEH0X%2FIeQ9%2B6l6mpDWygtQsEbXfXBt5hMNbBJ1sysq39vst4qSMlDYHLOyZkzM0Vpm3ErFh09uw28dIDE3mzjUHy%2BzHgXnPASDQonLaAgJerF5YUYZ4VogyevfMN3OfspEhECGe84W69m3OiyqEqtj4qJPn48VpPTid5CVZ2V2yoeXQFn9xAwEmY88iMLsYO1Q5KOYqkoJ6NyPCqr2%2BJUFIU4OnngbBXbME7SwHomalHked%2F3mZE2Q5knn4ies8W3m6V32FkINYRXo%2BBuc%2FFLjEiKgplVmD351yRQ19e3qVQbgjyF98XDfKGQzw8PGJsOYYjBbpgnrX%2Blpvkf3C%2BzFVcxvPXqxjdGvbNzH6yk%2FdmmitGj7QAVbYoNCRzFPpvG98sAkmDGKXQx1fzPX1%2BzBz1sQkyD4I3Y0ttWBoMpRmucsZ39bO6nvV34sonD3cB2vnf%2BSqiEi%2BWbePU%2B6O8I%2FtUaTOb7XEbID2B3j%2Bcf&RelayState=4HJJpMAHJeueSnTMBVnXbQOgfD40Iflm7Pw634vjLS3ixC30iiyn0KSU&SigAlg=http%3A%2F%2Fwww.w3.org%2F2000%2F09%2Fxmldsig%23rsa-sha1&Signature=TBpNF9ogK0ttQDG%2BbKAxwDfZhiYhycCK7zZBsKmhwo%2Bf7SMJKn%2FXufzHaqtAsV5TvI0TUs3ac7TPOP9%2FUvbRB3xc3V7vYh6Dl7xOXhYWAAgGefQuk8KBsm6iUke%2BGGe2ahYRPEFZA5wvQXyO23kYmGYzZeZauQeToBMfNh7%2BzjQJ0ud6waarmokXFVoD9xMrVfg0GrgugmP2217SUt7G5Fy7WAQFgyRJjiat%2Byliqe7VQzEwkh4u0IHvkb7YcpQh%2FKn5FpvoB3tRpkIMSYHpAI7r2TseK4aoQAgJphTd4m0Yf3MWhVzIjqCsZ5DxjvouxC3pZ1pQNAMF%2FeO7xt%2BP%2BA%3D%3D&lang=ar
Can you please provide me the way to supply this
Thank,
Rahil
------------------------------
Rahil Anwar
Original Message:
Sent: Sun December 15, 2019 04:37 AM
From: Rahil Anwar
Subject: Sending lang=ar in HTTP Request to IDP
Hi Jon,
Firstly thanks a bunch for your response.
1) What SSO Protocol (I assume SAML 2.0)?
Rahil: Yes, its SAML 2.0
2) How is SSO request sent to IdP? HTTP Request, HTTP Post?
Rahil: The end user accessing link contains RequestBinding=HTTPPost ; where as in Federation definition under IDP its redirect
3) Is the SSO request signed?
Rahil: Require outgoing SAML authentication requests to be signed. Its checked
4) Where does the IdP want to receive the lang=ar information? HTTP Header, Query String, some specific part of SSO Request message?
Rahil: The language consistency will be maintained during the authentication. "lang" HTTP attribute will be sent from the service provider to IAM as part of the Authentication Request (as additional parameter). The SAML2 response is sent from IAM back to the service provider including the "lang" as SAML2 attribute.
Here ISAM Is service provider.
Thanks,
Rahil
------------------------------
Rahil Anwar
Original Message:
Sent: Thu December 12, 2019 02:59 AM
From: Jon Harry
Subject: Sending lang=ar in HTTP Request to IDP
Hi Rahil,
A few questions:
1) What SSO Protocol (I assume SAML 2.0)?
2) How is SSO request sent to IdP? HTTP Request, HTTP Post?
3) Is the SSO request signed?
4) Where does the IdP want to receive the lang=ar information? HTTP Header, Query String, some specific part of SSO Request message?
Thanks... Jon.
------------------------------
Jon Harry
Consulting IT Security Specialist
IBM