forked from membrane/api-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproxies.xml
More file actions
41 lines (31 loc) · 1.72 KB
/
proxies.xml
File metadata and controls
41 lines (31 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<spring:beans xmlns="http://membrane-soa.org/proxies/1/"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://membrane-soa.org/proxies/1/ http://membrane-soa.org/schemas/proxies-1.xsd">
<router>
<serviceProxy name="Membrane Resource service" port="2000">
<!-- Protects a resource with OAuth2 - blocks on invalid login -->
<oauth2Resource2>
<membrane subject="sub" src="https://accounts.google.com" clientId="YOUR CLIENT ID HERE" clientSecret="YOUR CLIENT SECRET HERE" scope="openid email profile" claims="name" claimsIdt="email" />
</oauth2Resource2>
<!-- Use the information from the authentication server and pass it to the resource server (optional) -->
<groovy>
def oauth2 = exc.properties.'membrane.oauth2'
<!-- Put the eMail into the header X-EMAIL and pass it to the protected server. -->
exc.request.getHeader().setValue('X-EMAIL',oauth2.userinfo.email)
CONTINUE
</groovy>
<target host="localhost" port="3000"/>
</serviceProxy>
<serviceProxy port="3000">
<groovy>
exc.setResponse(Response.ok("You accessed the protected resource! Hello " + exc.request.header.getFirstValue("X-EMAIL")).build())
RETURN
</groovy>
</serviceProxy>
<serviceProxy port="9001">
<adminConsole/>
</serviceProxy>
</router>
</spring:beans>