concept user in category camel

appears as: users, user, users, A user, user
Camel in Action

This is an excerpt from Manning's book Camel in Action.

Camel has an active community. It’s a long-lived one too. It has been active (and growing) for more than 10 years at the time of writing. Having a strong community is essential if you intend to use any open source project in your application. Inactive projects have little community support, so if you run into issues, you’re on your own. With Camel, if you’re having any trouble, users and developers alike will come to your aid. For more information on Camel’s community, see appendix B.

Clients can call the order method with an Order object as the only argument. The Order object contains a part name, amount to order, and the customer name. An OrderResult is returned and can tell the user whether the order succeeded or failed. The big missing piece here is that it’s by default unsecured! Anyone who knows the endpoint address can submit an order—hardly ideal for Rider Auto Parts or the customer who will be charged for the parts. The Rider Auto Parts developer team clearly needs to add authentication to this service.

With authentication, a user proves who they are to a system, typically using a username and password. In the web-services world, this is encapsulated in a <UsernameToken> element within the SOAP message. The receiver of a SOAP message with a UsernameToken can check things such as whether a username exists, whether a password is valid, or if the timestamp on the token is still valid. Consider this example UsernameToken:

Listing 14.4 WS-Security client-side configuration
protected static OrderEndpoint createCXFClient( String url, String user, String passwordCallbackClass) { List<Interceptor<? extends Message>> outInterceptors = new ArrayList<>(); // Define WSS4j properties for flow outgoing Map<String, Object> outProps = new HashMap<>(); outProps.put("action", "UsernameToken Timestamp");     #1 outProps.put("user", user);     #2 outProps.put("passwordCallbackClass", passwordCallbackClass);     #3 WSS4JOutInterceptor wss4j = new WSS4JOutInterceptor(outProps); // Add LoggingOutInterceptor LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor(); outInterceptors.add(wss4j); outInterceptors.add(loggingOutInterceptor); // we use CXF to create a client for us as its easier than JAXWS and works JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();     #4 factory.setOutInterceptors(outInterceptors); factory.setServiceClass(OrderEndpoint.class); factory.setAddress(url); return (OrderEndpoint) factory.create(); } @Test public void testOrderOk() throws Exception { OrderEndpoint client = createCXFClient( "http://localhost:9000/order", "jon", "camelinaction.wssecurity.ClientPasswordCallback"); OrderResult reply = client.order(new Order("motor", 100, "honda"));     #5 assertEquals("OK", reply.getMessage()); } #1 Sets the actions to use when processing the UsernameToken #2 Specifies the user #3 Specifies the callback to use to grab the password #4 Uses a CXF factory bean to create the OrderEndpoint #5 Places an order using the OrderEndpoint

Before you create a business-as-usual JAX-WS web service using a CXF factory bean ❹, you need to configure WSS4JOutInterceptor. You use the same actions as on the server side ❶. You want to specify UsernameToken and Timestamp so a passed authentication doesn’t last indefinitely. You’re on the client side now, so you need to specify the user you want accessing the remote service. You do this by adding a user entry for the user named jon ❷. You specify a different callback handler on the client side ❸, which we’ll discuss next. Finally, you place an order using OrderEndpoint created by the CXF JAX-WS factory bean ❺; this will invoke the remote web service and return a result. All the marshaling and networking is handled by CXF under the hood.

Figure 18.7 The cloud shape represents the worker nodes that Kubernetes exposes as a single container-based platform. The Kubernetes master orchestrates and supervises the platform. Users can deploy applications by applying Kubernetes manifest files to the Kubernetes master.

c18_07.png