WSO2 Integrator: How do Inbound Endpoints reroute requests to resources - wso2

I am trying to understand how the WSO2 micro integrator reroutes requests internally. I know that inbound endpoints basically enable services to be available on a different port. So, does it maintain a list of resources that are mapped to this inbound endpoint and simply act as a passthrough? For example:
I have API resource defined at: http://localhost:8290/healthcare/querydoctor/{category}.
Then create inbound endpoint at port 8505 with Dispatch File Pattern: /healthcare/querydoctor/.*.
At this point does it internally create a map that says http://localhost:8285/healthcare/querydoctor/.* = [http://localhost:8290/healthcare/querydoctor/{category}, ...]
Also, I saw this in the wso2 documentation:
The HTTP inbound endpoint can bypass the inbound side axis2 layer and directly inject messages to a given sequence or API. For proxy services, messages are routed through the axis2 transport layer in a manner similar to normal transports.
What does bypassing the axis2 layer mean, and why is that being done in this case?

Basically, Axis2 is the default transport layer of MI. For example, if you invoke an API through port 8280 it will go through the Axis2 layer and come into the integration layer. If you invoke an HTTP/S Inbound Endpoint it will not go through the transport layer again, it will be routed internally to the Proxy or API if you have a Dispatch Pattern.
The following image will help you to understand the Inbound Endpoint architecture.

Related

Allow request from API Gateway to private ALB

I have a public API gateway set up, I want to forward the requests from API Gateway to a private ALB in the VPC. On AWS Console, for API Gateway VPC link setup I could only select an NLB in the VPC.
Is there a reason why we can only route to NLB and not to ALB?
Is there a way I can route to private ALB from the API Gateway?
Currently AWS only supports connecting to NLB for VPC link integrations. They have a feature request in place to enable support for ALB as well. For now, you can do -
Public API --> VPC Link --> NLB --> ALB
In the target groups of the NLB, add the private IPs of the ALB. This way you can reap benefits of the NLB (TCP layer) and ALB (HTTPS).
Using static IP addresses for Application Load Balancers
The selected answer is outdated. It is possible to have API Gateway integrate, thorugh http, with an internal facing ALB by using VPC Link and private resource integration.
For step by step details, see my answer on another question: https://stackoverflow.com/a/67413951/2948212
edit: I see I was confusing this post with another one... I believe my answer still adds value though, so I am leaving it (I thought this specified REST API Gateways and not HTTP API Gateways, but it does not).
Answer
While #diegosasw's answer is valid and useful, it is for AWS HTTP API Gateways, not AWS REST API Gateways.
With that being said, they are correct in saying it is possible! Please see the following AWS documentation regarding how to accomplish this: https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-application-load-balancers/
Please note one particular downside of AWS's documented approach: it requires a public ALB. Of course this is not ideal, though one can still harden their ALB so that it only accepts traffic originating from the REST API Gateway. If this is not acceptable for the existing use case, then #Suraj Bhatia's answer above must be followed (for REST API integrations, at least). If HTTP Gateways are acceptable, then #diegosasw's answer is the better approach to take due to it being simpler to manage and still allowing for a private ALB 🙂
For prosperity, AWS's documentation states the following:
Note: The following procedure assumes two things:
You have access to a public Application Load Balancer and its DNS
name. You have an API Gateway REST API resource with an HTTP method.
In the API Gateway console, choose the API you want to integrate with the Application Load Balancer.
In the Resources pane, for Methods, choose the HTTP method that your API uses.
Choose Integration Request.
In the Integration Request pane, for Integration Type, choose HTTP.
Note: To pass the entire API request and its parameters to the backend
Application Load Balancer, create one of the following instead: An
HTTP proxy integration
-or- An HTTP custom integration
For more information, see Set up HTTP integrations in API Gateway.
In the Endpoint URL field, enter either the Application Load Balancer's default DNS name or custom DNS name. Then, add the
configured protocol of its listener. For example, an Application Load
Balancer that's configured with an HTTPS listener on port 8080
requires the following endpoint URL format: https://domain-name:8080/
Important: Make sure that you create an HTTP listener or HTTPS
listener for the Application Load Balancer using the port and listener
rules of your choice. For more information, see Listeners for your
Application Load Balancers. For an Application Load Balancer
configured with an HTTPS listener, the associated certificate must be
issued by an API Gateway-supported certificate authority. If you have
to use a certificate that's self-signed or issued by a private
certificate authority, then set insecureSkipVerification to true in
the integration's tlsConfig.
Choose Save.
Deploy the API.

AWS secure REST API with mutual authentication

I want to secure a REST API with mutual authentication on AWS. This means, only clients with a specific client certificate should be able to access the API. What is the best way to secure a REST API on AWS with mutual authentication?
I know, there is client certificate support for API Gateway, but this is not what I am looking for. As far as I understand, this only authenticates Api Gateway against backend and is not able to authenticate clients to Api gateway.
Is Api Gateway, Load balancer or any other AWS product able to do mutual authentication to secure a rest API or do I need to implement this by my own?
You'll have to do this on your servers.
None of the services that terminate TLS and forward requests or connections to your app tier -- Elastic Load Balancers (Classic, Application, and Network), CloudFront, or API Gateway -- support TLS mutual auth.
Of course, a Network Load Balancer without TLS termination or a Classic Load Balancer in TCP mode will pass-through your payload, whatever it is, so either of these can be used in front of your servers, but the servers will need to handle all the TLS.
Also, your conclusion is correct that API Gateway's client certificates are not what you are looking for. They work as you described them.
As of 17th September, 2020, support for Mutual Authentication using TLS is available on AWS API Gateway: https://aws.amazon.com/about-aws/whats-new/2020/09/amazon-api-gateway-supports-mutual-tls-authentication/ . It can be used to authenticate clients calling an API on API Gateway.

Is having an endpoint at http: a security risk for the Web Service

I have generated a JAX-WS web service with RAD 8.5 which automatically generated an endpoint for the service at "http:endpoint". I generated a client for the web service from the WSDL and added transport security (SSL) to the web service and added a secure endpoint using the following line of code in my client:
proxy._getDescriptor().setEndpoint("https:endpoint");
Everything seems to work fine. My question is do I need to do anything about the existence of the original endpoint ant "http:endpoint". This is an in-house web service so all of the apps which use it in house will use the secure endpoint, but is the availability of the unsecure endpoint a security risk for the web service? If so, what do I need to do to fix it? Any help would be appreciated.
I am not familiar with the Framework you are using, but there should be a configuration in your proxy to not allow http calls at all. If you have that option, turn it on so that your service only listens on port 443 (secure port).
An alternative would be to rewrite all http requests with https.

In Web services, what is difference between Endpoint and Remote Gateway

I goggled but I cannot determined what are the difference between endpoint and gateway. Based on their definition, they seems alike.
Description of Endpoint
What is Web Service Gateway? Web Service Gateway is a server-side
application that opens a communication channel between Bentley’s Apps
for mobile devices and Bentley’s project information management
systems.
Description of Web Service
Web services expose one or more endpoints to which messages can be
sent. A web service endpoint is an entity, processor, or resource that
can be referenced and to which web services messages can be addressed.
Endpoint references convey the information needed to address a web
service endpoint. Clients need to know this information before they
can access a service.
Endpoint:
The endpoint is a connection point where HTML files or active server pages are exposed. Endpoint is the URL where your service can be accessed by a client application. The same web service can have multiple endpoints. An end point indicates a specific location for accessing a service using a specific protocol and data format.
GateWay:
An service Gateway provides a central access point for managing, monitoring, and securing access to your publicly exposed web services. It would also allow you to consolidate services across disparate endpoints as if they were all coming from a single host. A service gateway encapsulates all the details of accessing the service into a single component and hides the component behind an interface that has no direct dependencies on the underlying communications channel.

Default endpoint in esb

i'm using wso2esb 4.7.0 and wso2dss 3.0.0. when i have started with these server their was less load on servers as their are less no of services.but now situation changes.Their are no of services on server and each proxy contain particular address endpoint of dss. After calling this address endpoint it navigate to that endpoint and retrieve information and give the response. This is general scenario of all the service.
Day by day no of services increases and due to the load the server getting slower. That's why i wish to create a particular default endpoint from where i can call the service easily. No need to call the address endpoint and all. Is it possible? how can i implement this?
for load balancing i have used Amazon AWS Elastic Load Balancer.
The question is not clear. For all proxy services your endpoints are different or not? I mean, all different endpoints calling same dataservice or different. If they are different, you need to have different endpoints. If all endpoints point same dataservice, then you do not need to have multiple copy of same endpoint. Define only one endpoint and use that in all proxyservices. When you define proxy service there is a option to define endpoint, where select the existing predefined endpoint.