You can enable extensions to authenticate users coming from Endeca Workbench by including an authentication token in the URL.

Oracle Commerce Workbench calculates the value of the token by generating an SHA-256 hash from a portion of the URL and a shared secret. The portion of the URL that is used for the hash consists of everything after the host name and port, including the leading slash, but excluding the value of the AUTH token itself. The shared secret is a string that is specified in ws-extensions.xml and is also stored in the extension itself.

For example, the following ws-extensions.xml file defines an extension with a URL that uses the AUTH and TS tokens:

<?xml version="1.0" encoding="UTF-8"?>

<extensions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:noNamespaceSchemaLocation="extensions.xsd">
	<extension id="authExtension"
		defaultName="Authenticated Extension"
		defaultDescription="Demonstrates token-based authentication."
		url="http://localhost:8080/AuthExtension/index.jsp?timestamp=${TS}&amp;
auth=${AUTH}"
		sharedSecret="secret!@#$%^*(987654321" />
</extensions>

In this case, the value of the authentication token is the hash of a String similar to the following:

/AuthExtension/index.jsp?timestamp=1189702462936&auth=secret!@#$%^*(987654321

The extension can verify that a user is coming from Oracle Endeca Workbench by calculating the hash of the same string and comparing the result to the value of the AUTH token. This ensures that the user visiting the extension has logged in to Oracle Commerce Workbench and has the permission (if any) that is required to access the extension.

Because the AUTH token is based in part on the URL, it is recommended that you include the time stamp of the request to introduce some variation in the value of the token. The time stamp can also be used to filter out stale requests and limit the possibility of an eavesdropper reusing the same URL to gain access to the extension.

The following Java code shows how the extension defined in the preceding example can authenticate users from Oracle Commerce Workbench:

The example extension places the AUTH token at the end of the URL, making it more convenient to build the substring of the URL for the hash.

However, the AUTH token can be in any position in the URL. For instance, the URL can be defined in ws-extensions.xml as follows:

url="http://localhost:8080/AuthExtension/index.jsp?auth=${AUTH}&amp;
timestamp=${TS}"

This results in a URL similar to this:

http://localhost:8080/AuthExtension/index.jsp?auth=dc40570f2e7111fbe1af820a854ca817&timestamp=1189702462936

The value of the authentication token is the hash of a String similar to the following:

/AuthExtension/index.jsp?auth=&timestamp=1189702462936secret!@#$%^*(987654321

In this case, the code in the extension to remove the value of the authentication token from the URL is more complex.


Copyright © Legal Notices