REST Proxy module
Edition |
Incubator (services) |
||
Git |
|||
Latest |
1.0
|
The REST Proxy module is used to proxy REST calls to another API via Magnolia. This way passwords and security critical information can be hidden from the browser.
|
This module is at the INCUBATOR level. |
Installing with Maven
Maven is the easiest way to install the module. Add the following to your bundle:
<dependency>
<groupId>info.magnolia.restproxy</groupId>
<artifactId>magnolia-rest-proxy</artifactId>
<version>1.0</version>
</dependency>
Configuration
The configuration consists of two parts. A REST endpoint that is exposed by Magnolia and a REST client that requests to the endpoint are proxied to.
REST endpoint
class: info.magnolia.restproxy.service.ConfiguredRestProxyEndpointDefinition
restClientName: <REST_CLIENT_NAME> (1)
restCallName: <REST_CLIENT_METHOD_NAME> (2)
| 1 | Replace with the actual REST client name. |
| 2 | Method name such as GET, PUT, POST. |
REST client
Below is an example for the REST client.
See the The endpointPath property to see how how endpoints configured in the same light module directory are exposed under a common path segment. |
baseUrl: <URL to the existing service> (1)
securitySchemes:
b1:
$type: basic
username: <username for the existing service>
password: <password for the existing service>
restCalls:
<REST_CLIENT_METHOD_NAME>: (2)
method: get
path: /<path of the method>/${idProperty}
securityScheme: b1
| 1 | Be sure to add your value to baseUrl. |
| 2 | Be sure to add your method here. |