forked from membrane/api-gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapis.yaml
More file actions
42 lines (38 loc) · 1.13 KB
/
apis.yaml
File metadata and controls
42 lines (38 loc) · 1.13 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
42
# yaml-language-server: $schema=https://www.membrane-api.io/v7.1.2.json
api:
name: Membrane Resource service
port: 2000
flow:
- log: {}
# Protects a resource with OAuth2 - blocks on invalid login
- oauth2Resource2:
membrane:
src: https://accounts.google.com
clientId: YOUR CLIENT ID HERE
clientSecret: OUR CLIENT SECRET HERE
scope: openid email profile
claims: name
claimsIdt: email
# Use the information from the authentication server and pass it to the resource server (optional)
- groovy:
src: |
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
target:
host: localhost
port: 3000
---
api:
port: 3000
flow:
- groovy:
src: |
exc.setResponse(Response.ok("You accessed the protected resource! Hello " + exc.request.header.getFirstValue("X-EMAIL")).build())
RETURN
---
api:
port: 9001
flow:
- adminConsole: {}