I am new to Camel (on Spring Boot) and implementing REST API using "netty-http" component.
For Basic auth on a service, I know that we can validate the headers in a .process method in the route, but I am not sure if that is a best practice.
I wanted to know if anyone can share some info on implementing Basic Auth or oAuth validation on the Camel Routes using spring security.
Java DSL Code below:
@Component
public class RetrieveRestAPI extends RouteBuilder {
@Autowired
RetrieveData retrieveData;
@Override
public void configure() throws Exception {
restConfiguration()
.component("netty-http")
.port("{{http.port}}")
.bindingMode(RestBindingMode.auto)
;
//TODO: Basic Auth
//TODO: oAuth token validation..
rest("/{{BasePath}}/{DataId}")
.get()
.to("direct:fetchData");
from("direct:fetchData")
.process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
log.info("some code here..");
}
})
.end();
}
Thanking you, V.