There are times when you may want to store values in neither clear text properties nor in temporary files. Secure tasks are defined using the secure-task.xml
file. These tasks take the collected data collected and store it in a credential store. Data stored within the credential store cannot be read as clear text. For additional information on credential stores, refer to the Platform Programming Guide.
The atg.cim.model.SecureTask
class creates the interface that collects data to store. The atg.cim.model.SecureTaskFactor
creates a SecureTask
by credential
type
. The secure task uses the atg.cim.worker.SercureWorkerTask
to handle steps within the SecureTask
. It uses the map
and keyName
properties to access values from the credential store when needed.
The following attributes are required:
map-name
– The name of a map used to define credentials.key-name
– The name of a key used to define credentials.credential-type
– The type of credentials that are associated with the data. There are three credential-type properties:GENERIC – Can contain a single line or string. If you use this
credential-type
, theSTcredential
property must be included as it will be stored in the credential store. Not having these properties will result in an error.LOGIN – Takes credentials from the username and password of the user. When using this
credential-type
, theSTusername
andSTpassword
are reserved and are required to store the username and password values into the credential store. Not having these properties will result in an error.DATASOURCE – Takes credentials from the username, password, resource location and port of the user. If using this
credential-type
, theSTusername
,STpassword
,STresourceLocation
andSTport
are reserved and required to store the values into the credential store. Not having these properties will result in an error.
Additional properties can be defined, but the property name must be defined and available, similarly to the ST*
properties.
GENERIC Credential Type Example
The following example creates a GENERIC credential-type
UI element:
<tasks> <secure-task id="SecureCredentialTask" map-name="cim-sctmap" key-name="generic-key-xml" credential-type="GENERIC" class="atg.cim.productconfig.opss.DisplayCredentialTask"> <property name="STcredential"> <input type="text"> <label>Enter your credentials</label> </input> <validator id="CannotBeBlankValidator" phase="POSTINPUT"> <if-false> <command type="DISPLAY_TEXT" value="This property cannot be blank" /> <command type="REDO_INPUT"/> </if-false> </validator> </property> </secure-task> </tasks>
Note the use of the STcredential
property. This property is required for storing data in the credential store when using a GENERIC credential-type
.
LOGIN Credential Type Example
The following example shows how a LOGIN credential-type
might be written:
<tasks> <secure-task id="SecureLoginCredentialTask" map-name="cim-testmap" key-name="login-key-xml" credential-type="LOGIN" class="atg.cim.productconfig.opss.DisplayCredentialTask"> <property name="STusername"> <input type="text"> <label>Enter username</label> </input> <validator id="CannotBeBlankValidator" phase="POSTINPUT"> <if-false> <command type="DISPLAY_TEXT" value="This property cannot be blank" /> <command type="REDO_INPUT"/> </if-false> </validator> </property> <property name="STpassword"> <input type="password"> <label>Enter password</label> </input> <validator id="CannotBeBlankValidator" phase="POSTINPUT"> <if-false> <command type="DISPLAY_TEXT" value="This property cannot be blank" /> <command type="REDO_INPUT"/> </if-false> </validator> </property> </secure-task> </tasks>
Note the use of the STusername
and STpassword
properties, which are required properties used to store the user name and the password in the credential store.
DATASOURCE Credential Type Example
The following shows how a DATASOURCE credential-type
might be written:
<tasks> <secure-task id="TestDatasourceCredentialTask" map-name="cim-testmap" key-name="datasource-key-xml" credential-type="DATASOURCE" class="atg.cim.productconfig.opss.DisplayCredentialTask"> <property name="STusername"> <input type="text"> <label>Enter DSXML Username</label> </input> <validator id="CannotBeBlankValidator" phase="POSTINPUT"> <if-false> <command type="DISPLAY_TEXT" value="This property cannot be blank" /> <command type="REDO_INPUT"/> </if-false> </validator> </property> <property name="STpassword"> <input type="password"> <label>Enter DSXML Password</label> </input> <validator id="CannotBeBlankValidator" phase="POSTINPUT"> <if-false> <command type="DISPLAY_TEXT" value="This property cannot be blank" /> <command type="REDO_INPUT"/> </if-false> </validator> </property> <property name="STresourceLocation"> <input type="text"> <label>Enter DSXML URL</label> </input> <validator id="CannotBeBlankValidator" phase="POSTINPUT"> <if-false> <command type="DISPLAY_TEXT" value="This property cannot be blank" /> <command type="REDO_INPUT"/> </if-false> </validator> </property> <property name="STport"> <input type="text"> <label>Enter STXML Port</label> </input> <validator id="CannotBeBlankValidator" phase="POSTINPUT"> <if-false> <command type="DISPLAY_TEXT" value="This property cannot be blank" /> <command type="REDO_INPUT"/> </if-false> </validator> </property> </secure-task> </tasks>
The DATASOURCE credential type stores the STusername
, STpassword
, STresourceLocation
and STport
properties in the credential store.