≈ the.bay.news

gRPC has no [Authorize] seam: enforcing Keyright entitlements with a server-side Interceptor

DEV Community
gRPC has no [Authorize] seam: enforcing Keyright entitlements with a server-side Interceptor
A gRPC service has no MVC filter pipeline and no [Authorize] attribute to hang a license check on — the one seam that sees every call is the server Interceptor. This post writes a LicensingInterceptor that validates a Keyright license once, maps each gRPC method to a required entitlement, and fails closed with the right status: FailedPrecondition when there is no valid license, PermissionDenied when the license lacks the entitlement, ResourceExhausted when a numeric limit is spent. Plus a cached hot path that never round-trips the issuing service, DI registration via AddGrpc, and the streaming variants.

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.