Search⌘ K
AI Features

Securing gRPC Endpoints

Explore how to secure gRPC endpoints in ASP.NET Core by applying authorization requirements using attributes and policies. Learn to configure both the gRPC client and server for proper authentication flow, manage bearer tokens, and differentiate access for secured and anonymous calls.

There are multiple ways of applying requirements on individual gRPC endpoints, and we will examine some of them in this lesson. The following playground demonstrates how it can be done:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}
gRPC service with authorization rules applied on individual endpoints

Note: Because we have to build two ASP.NET Core applications and populate the IdP database with the initial seed data, the build process is expected to take at least a few minutes.

The playground consists of the following three applications:

  • DemoApp: It is a Razor Pages application that acts as a gRPC client.

  • SecondaryApiApp: It is a gRPC server ...