Search code examples
javaamazon-web-servicesapache-cameljbossfuseapache-servicemix

Does a camel component exist for using AWS SDK InitiateAuth?


We want to implement the authentication of an interface in apache-camel using AWS SDK InitiateAuth, where the AuthFlowType is USER_SRP_AUTH. Is there already a camel component? I found this list of camel aws components, but I don't know if I can use one of them. I will proof that, but maybe one of you have some experience with it.

[EDIT] Actually I would like to call a WebService with camel-cxf and for that I should use AWS SDK for the authentication. After all, it is an OAuth flow, which I may also be able to portray with CXF?


Solution

  • Sure, Apache Camel has a plenty of components for amazon. Please, see this reference

    Each component has its own methods to achieve what you want. In almost each component you have to do authentication. Camel is about sending messages and each message should be decorated with appropriate header and body.

    This might come handy. There are headers supposed to to authentication.

    From what i have read, amazon uses queues to send and receive data. The component hidden behind above link should do the trick

    If your Camel Application is running behind a firewall or if you need to have more control over the AmazonSQSClient configuration, you can create your own instance:

    AWSCredentials awsCredentials = new BasicAWSCredentials("myAccessKey", "mySecretKey");
    
    ClientConfiguration clientConfiguration = new ClientConfiguration();
    clientConfiguration.setProxyHost("http://myProxyHost");
    clientConfiguration.setProxyPort(8080);
    
    AmazonSQSClient client = new AmazonSQSClient(awsCredentials, clientConfiguration);
    

    and refer to it in your Camel aws-sqs component configuration:

    from("aws-sqs://MyQueue?amazonSQSClient=#amazonSQSClient&delay=5000&maxMessagesPerPoll=5")
        .to("mock:result");