Last active
August 26, 2021 11:49
-
-
Save ldclakmal/76517ededbe280f9dc1ee803db051c54 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ballerina/http; | |
import ballerina/graphql; | |
listener http:Listener apiGateway = new(9090, | |
secureSocket = { | |
key: { | |
certFile: "/path/to/public.crt", | |
keyFile: "/path/to/private.key" | |
} | |
} | |
); | |
@http:ServiceConfig { | |
auth: [ | |
{ | |
oauth2IntrospectionConfig: { | |
url: "https://localhost:9443/oauth2/introspect", | |
clientConfig: { | |
customHeaders: {"Authorization": "Basic YWRtaW46YWRtaW4="}, | |
secureSocket: { | |
cert: "/path/to/sts-public.crt" | |
} | |
} | |
}, | |
scopes: ["customer"] | |
} | |
] | |
} | |
service /foo on apiGateway { | |
resource function post bar() returns json|error { | |
// business logic | |
} | |
} | |
@graphql:ServiceConfig { | |
auth: [ | |
{ | |
oauth2IntrospectionConfig: { | |
url: "https://localhost:9443/oauth2/introspect", | |
clientConfig: { | |
customHeaders: {"Authorization": "Basic YWRtaW46YWRtaW4="}, | |
secureSocket: { | |
cert: "/path/to/sts-public.crt" | |
} | |
} | |
}, | |
scopes: ["customer"] | |
} | |
] | |
} | |
service /bar on new graphql:Listener(apiGateway) { | |
resource function get foo() returns json|error { | |
// business logic | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment