In this section we look at a sample on how to create the static security policy resource and the proxy service. These are packed into a single CApp and deployed in the ESB server.
- An XML file containing the security policy for the proxy service needs to be created. Sample content of a simple user name-token security policy is available here.
- Registry Resources with the endpoint URLs to be created as in the previous sample.
To create the security policy and proxy service projects:
Create an XML file containing the security policy. For this sample, we look at a simple authentication policy using X509 certificate. The XML configuration details are available here.
Note: Currently Developer Studio tooling has a limitation where it does not support security policies for user name token authentication.
- Create a Registry Resources Project named 'HelloWorldStaticResources'.
- To create a new Registry Resource for the policy, right-click the project and select New > Registry Resource.
- Choose Import from file system.
- Browse and select the XML file containing the policy from the file system.
- Select 'gov' as the Registry.
- Specify '
policies/HelloWorld' as the Registry path to deploy.
To create an ESB proxy service:
- Select the HelloWorldApp project, right-click and select New > Proxy Service.
- Select Create a New Proxy Service.
- Select Secure Proxy.
- Click on Create new ESB Project and set the name as HelloWorldProxyServices.
- In the Advanced Configuration section, select Pick from Registry.
- Set the endpoint key to
Set the security policy key as
Note that this indicates that we are using the governance section of the registry, and what is visible from the ESB is the
/policies/HelloWorld/SignOnly.xmlURL. This URL remains the same across all environments.
- The projects setup is now complete.
To create CApp projects for each CApp archive:
- Create a resource CApp with the dynamic resources created in the previous sample.
- Create a CApp with the static resource and proxy service we created in the steps above.
- The next step is to create the CApp to contain the static resource (security policy) and the proxy service.
To create and use a HelloWorldCApp Carbon Application project:
- Select the HelloWorldApp multi-module project.
- Choose File > New > Carbon Application Project from the main Eclipse menu.
- Name the project HelloWorldCApp.
- Select the HelloWorldProxyServices and HelloWorldStaticResources in the dependencies list.
- Click Next.
- Set the artifactID to HelloWorld (this ensures a HelloWorld-<versionNumber>.car file is created).
- Click Finish.
- When the CApp is created, expand the CApp in the Project Explorer window and select pom.xml.
- Select HelloWorldStaticResources and expand.
- Change the server role to ESB since we are deploying this CApp in the ESB. Select Enterprise Service from the drop down list.
- Your final project structure should now look like this:
Right-click the top project (HelloWorldApp) and select Generate POM. Select all the HelloWorld projects, which are then added as modules to the top multi-module Maven project. If you look at the top project pom.xml, you should see the following entries inside:
Your projects are now ready to be built and deployed.