Skip to content

Instantly share code, notes, and snippets.

@ldclakmal
Last active February 9, 2022 13:26
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/7d0b04c3244153c54e415171aacb5a1d to your computer and use it in GitHub Desktop.
Save ldclakmal/7d0b04c3244153c54e415171aacb5a1d to your computer and use it in GitHub Desktop.
import ballerina/grpc;
import ballerina/jwt;
listener grpc:Listener paymentsEP = new(9191,
secureSocket = {
key: {
certFile: "/path/to/public.crt",
keyFile: "/path/to/private.key"
}
}
);
@grpc:ServiceConfig {
auth: [
{
jwtValidatorConfig: {
issuer: "order-service",
audience: "payment-service",
signatureConfig: {
certFile: "/path/to/order-service-public.crt"
},
scopeKey: "scp"
},
scopes: ["admin"]
}
]
}
@grpc:ServiceDescriptor {
descriptor: ROOT_DESCRIPTOR,
descMap: getDescriptorMap()
}
service "PaymentService" on paymentsEP {
remote function payments(ContextString request) returns string {
// business logic
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment