### Using Security Context

#### Using in the Formula Editor

The Formula Editor now allows you to pass the Security Context to a user-defined formula (UDF) function.

You can call getSecurityContext () in your formula, which will pass the returning object to your UDF function. The method getSecurityContext() returns a DbSecurityContext type object, which provides the method get () to get the Security Context instance transfer from Server or Designer.

DbSecurityContext is a new data type for the SecurityContext object, since the data type of all the variables used in UDF functions should be DbValue.

The following is an example.

`Import userClass from "UserFunction";
userClass.getData(getSecurityContext(), @country, …);`

#### Using in the Deployment Wizard

JReport provides you with two API methods which allow you to bring out your own publishing tool.

DeploymentWizard

- Package: com.jinfonet.designer.deployment.api
- Usage: DeploymentWizard is an interface used for implementing the customized publishing wizard.
- Method: deploy (Frame frame, String catFullPathName, String reporthome).
- Parameters:
  - frame - The frame of the deployment box.
  - catalogFullPath - The full path name of the catalog file.
  - reporthome - The report home path.

DeploymentWizardFactory

- Package: com.jinfonet.designer.deployment.api
- Usage: DeploymentWizardFactory is an interface used for implementing the customized deployment wizard.
- Method: getDeploymentWizard()
- Method description: Returns the DeploymentWizard.

##### Working principle

- Loading DeployWizardFactory class name from configuration information:

  In JReport Designer, there is a config.xml file in `<``install_root>\bin`. This file corresponds with the Options dialog. You can make it configurable by modifying the XML file. Designer loads information from the XML file and configures the Options dialog when it starts up.

- Getting DeployWizardFactory class name and showing the customized deployment wizard:

  When you click File > Publish To > JReport Enterprise Server in Designer, it will first check if there is deployWizardFactory in the ReportOption, and will then try to create new instance by the class name. If the class of the customized deployWizard has been successfully loaded, its wizard will be shown. Otherwise, the default publish wizard will be shown.

#### Using in viewing report

When you click on the View tab to view a report that requires the security context to run, JReport Designer will use the implemented JRSecurityContextFactory to instantiate the SecurityContext instance which will be used to execute the report.