防止在IBM Commerce Server 6中加密(Krypto)Url参数

时间:2009-08-19 16:08:09

标签: java commerceserver

您好我们正在使用IBM Commerce Sever使用下面的代码从一个视图移动到另一个视图。

protected void prepareResponse(){
...
String returnUrl = "www.example.com/aNewPage.jsp?aUrlParameter=123&anotherParameter=654"
...
StringBuffer sb = new StringBuffer(returnUrl);
sb.append("&storeId=").append(commandContext.getStoreId());
sb.append("&langId=-1");
responseProperties.put(ECConstants.EC_REDIRECTURL, sb.toString());
responseProperties.put(ECConstants.EC_VIEWTASKNAME, ECConstants.EC_GENERIC_REDIRECTVIEW);
}

我们最终的网址是www.example.com/aNewPage.jsp?krypto=ABCDF0LotsOfRandomCharacters 不幸的是,由于第三方整合,我们有javascript寻找未加密形式的url参数和couse它无法解密krypto参数。

此行为符合documentation

Flattening input parameters into a query string for HttpRedirectView

All input parameters that are passed to a redirect view command are flattened
into a query string for URL redirection. For example, suppose that the input
to the redirect view command contains the following properties:
URL = "MyView?p1=v1&p2=v2";
ip1 = "iv1"; // input to orginal controller command
ip2 = "iv2" ; // input to original controller command
op1 = "ov1";
op2 = "ov2";
Based upon the preceding input parameters, the final URL is
MyView?p1=v1&p2=v2&ip1=iv1&ip2=iv2&op1=ov1&op2=ov2
Note that if the command is to use SSL, then the parameters are encrypted
and the final URL appears as
MyView?krypto=encrypted_value_of“p1=v1&p2=v2&ip1=iv1&ip2=iv2&op1=ov1&op2=ov2”

现在的问题是: 如何防止这些url参数被加密?

1 个答案:

答案 0 :(得分:0)

加密的参数由wc-server.xml中的NonEncryptedParameters节点控制。将要保留为明文的url参数添加到该节点意味着它们不会被加密。

<NonEncryptedParameters display="false">
    <Parameter name="storeId"/>
    <Parameter name="langId"/>
    <Parameter name="catalogId"/>
    <Parameter name="categoryId"/>
    <Parameter name="productId"/>
</NonEncryptedParameters>

我在IBM's Forum上找到了答案,并找到了一个链接,该链接使用了NonEncryptedParameters Node来讨论为缓存目的而执行此操作。