Skip to content

Instantly share code, notes, and snippets.

@ldclakmal
Last active August 26, 2021 11:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ldclakmal/76517ededbe280f9dc1ee803db051c54 to your computer and use it in GitHub Desktop.
Save ldclakmal/76517ededbe280f9dc1ee803db051c54 to your computer and use it in GitHub Desktop.
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