Transport Level Security
- Open a terminal window.
- Cd to home, and execute the following command:
keytool -genkeypair -alias mycert -keysize 1024 -keyalg RSA -keypass skpass -storepass sspass -storetype JKS -keystore serviceKeystore.jks -dname cn=localhost |
---|
We are using keytool again, but in this case to create a digital (self-signed) certificate. | |
---|---|
- Back in JBDS, expand Lab12 project, and double-click on camel-context.xml.
- Click on the Source tab.
- Locate the <camelContext> element and position above it.
- Copy and paste the following XML code:
<sslContextParameters id="sslContextParameters" xmlns="http://camel.apache.org/schema/spring"> |
---|
The sslContextParameteres bean defines the SSL protocols to use and the location and characteristics of the key store that holds the SSL server certificate. | |
---|---|
- Click on the Design tab.
- Click on Routes -> Add Route.
- In the new empty canvas, drag and drop a Generic component from the Components palette.
- Click on the Generic component and on the Properties tab.
- In the URI, enter the following value:
jetty:https://0.0.0.0:8282/services?matchOnUriPrefix=true&sslContextParametersRef=sslContextParameters |
---|
The jetty component provides HTTP-based endpoints for consuming and producing HTTP requests. That is, the Jetty component behaves as a simple Web server or can also be used as a http client (camel producer). | |
---|---|
- Drag and drop a Transform component from the Transformation palette.
- Create a link between the jetty and the transform components.
- Click on the transform component and the Properties tab.
- Select constant as language.
- Enter “<html><body>Hello from JBoss Fuse</body></html>” as the expression.
- Save the file (Ctrl+S).
- Right-click on the Lab12 project, “Run As” -> “Maven build” to deploy the profile.
- Once the profile is successfully deployed in Fuse, go back to the console.
- Click on the Profiles tab.
- Search for the lab12Profile and click on the details.. link.
- Click on the Refresh button.
- Click on Assign button.
- Select the root container and click assign.
- Open a new browser tab.
- Go to https://localhost:8282/services.
- Click on “Advanced” button.
- Click on Add Exception..
- Uncheck the “Permanently store this exception”.
- Click on the “Confirm Security Exception” button.
- You should see the welcome message using a secure channel.