You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/security/authentication/configure-jwt-bearer-authentication.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,7 +125,7 @@ JWT bearer tokens should be fully validated in an API. The following should be v
125
125
* Audience claim with the expected value.
126
126
* Token expiration.
127
127
128
-
The following claims are required for OAuth 2.0 access tokens: `iss`, `exp`, `aud`, `sub`, `client_id`, `iat, and `jti`.
128
+
The following claims are required for OAuth 2.0 access tokens: `iss`, `exp`, `aud`, `sub`, `client_id`, `iat`, and `jti`.
129
129
130
130
If any of these claims or values are incorrect, the API should return a 401 response.
131
131
@@ -188,7 +188,7 @@ var requireAuthPolicy = new AuthorizationPolicyBuilder()
188
188
.Build();
189
189
190
190
builder.Services.AddAuthorizationBuilder()
191
-
.SetFallbackPolicy(requireAuthPolicy);
191
+
.SetDefaultPolicy(requireAuthPolicy);
192
192
```
193
193
194
194
The [Authorize](/dotnet/api/microsoft.aspnetcore.authorization.authorizeattribute) attribute can also be used to force the authentication. If multiple schemes are used, the bearer scheme generally needs to be set as the default authentication scheme or specified via `[Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme])`.
@@ -223,7 +223,7 @@ Asymmetric keys should **always** be used when creating access tokens. The publi
223
223
224
224
### Never create an access token from a username/password request
Copy file name to clipboardExpand all lines: aspnetcore/test/http-files.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -386,7 +386,7 @@ To generate a random integer, use `$randomInt`. The syntax is `{{$randomInt [min
386
386
387
387
*`$datetime` generates a `datetime` string in UTC. The syntax is `{{$datetime [format] [offset option]}}` where the format and offset options are optional.
388
388
*`$localDatetime` generates a `datetime` string in the local time zone. The syntax is `{{$localDatetime [format] [offset option]}}` where the format and offset options are optional.
389
-
*`$timeStamp` generates a `timestamp` in UTC. The `timestamp` is the [number of seconds since the Unix Epoch in UTC time](xref:System.DateTimeOffset.ToUnixTimeSeconds?displayProperty=nameWithType). The syntax is `{{$timestamp [offset option]}}` where the offset option is optional.
389
+
*`$timestamp` generates a `timestamp` in UTC. The `timestamp` is the [number of seconds since the Unix Epoch in UTC time](xref:System.DateTimeOffset.ToUnixTimeSeconds?displayProperty=nameWithType). The syntax is `{{$timestamp [offset option]}}` where the offset option is optional.
390
390
391
391
The `[format]` option is one of `rfc1123`, `iso8601`, or a custom format in quotation marks. For example:
Copy file name to clipboardExpand all lines: aspnetcore/tutorials/grpc/grpc-start.md
+21-57Lines changed: 21 additions & 57 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,12 @@ author: jamesnk
4
4
description: This tutorial shows how to create a gRPC Service and gRPC client on ASP.NET Core. Learn how to create a gRPC Service project, edit a proto file, and add a duplex streaming call.
5
5
monikerRange: '>= aspnetcore-3.0'
6
6
ms.author: wpickett
7
-
ms.date: 08/30/2023
7
+
ms.date: 01/30/2025
8
8
uid: tutorials/grpc/grpc-start
9
9
---
10
10
# Tutorial: Create a gRPC client and server in ASP.NET Core
11
11
12
-
:::moniker range=">= aspnetcore-8.0"
12
+
:::moniker range=">= aspnetcore-9.0"
13
13
This tutorial shows how to create a .NET Core [gRPC](xref:grpc/index) client and an ASP.NET Core gRPC Server. At the end, you'll have a gRPC client that communicates with the gRPC Greeter service.
14
14
15
15
In this tutorial, you:
@@ -23,15 +23,11 @@ In this tutorial, you:
23
23
24
24
# [Visual Studio](#tab/visual-studio)
25
25
26
-
[!INCLUDE[](~/includes/net-prereqs-vs-8.0.md)]
26
+
[!INCLUDE[](~/includes/net-prereqs-vs-9.0.md)]
27
27
28
28
# [Visual Studio Code](#tab/visual-studio-code)
29
29
30
-
[!INCLUDE[](~/includes/net-prereqs-vsc-8.0.md)]
31
-
32
-
# [Visual Studio for Mac](#tab/visual-studio-mac)
33
-
34
-
[!INCLUDE[](~/includes/net-prereqs-mac-8.0.md)]
30
+
[!INCLUDE[](~/includes/net-prereqs-vsc-9.0.md)]
35
31
36
32
---
37
33
@@ -43,13 +39,13 @@ In this tutorial, you:
43
39
* In the **Create a new project** dialog, search for `gRPC`. Select **ASP.NET Core gRPC Service** and select **Next**.
44
40
* In the **Configure your new project** dialog, enter `GrpcGreeter` for **Project name**. It's important to name the project *GrpcGreeter* so the namespaces match when you copy and paste code.
45
41
* Select **Next**.
46
-
* In the **Additional information** dialog, select **.NET 8.0 (Long Term Support)** and then select **Create**.
42
+
* In the **Additional information** dialog, select **.NET 9.0 (Standard Term Support)** and then select **Create**.
47
43
48
44
# [Visual Studio Code](#tab/visual-studio-code)
49
45
50
46
The tutorial assumes familiarity with VS Code. For more information, see [Getting started with VS Code](https://code.visualstudio.com/docs).
51
47
52
-
* Select **New Terminal** from the **Terminal** menu to open the [integrated terminal](https://code.visualstudio.com/docs/editor/integrated-terminal).
48
+
* Select **New Terminal** from the **Terminal** menu to open the [integrated terminal](https://code.visualstudio.com/docs/terminal/basics).
53
49
* Change to the directory (`cd`) that will contain the project.
54
50
* Run the following commands:
55
51
@@ -64,19 +60,11 @@ The tutorial assumes familiarity with VS Code. For more information, see [Gettin
* Start Visual Studio 2022 for Mac and select **File** > **New Project**.
70
-
* In the **Choose a template for your new project** dialog, select **Web and Console** > **App** > **gRPC Service** and select **Continue**.
71
-
* Select **.NET 8.0** for the target framework and select **Continue**.
72
-
* Name the project **GrpcGreeter**. It's important to name the project *GrpcGreeter* so the namespaces match when you copy and paste code.
73
-
* Select **Continue**.
74
-
75
63
---
76
64
77
65
### Run the service
78
66
79
-
[!INCLUDE[](~/includes/run-the-app6.0.md)]
67
+
[!INCLUDE[](~/includes/run-the-app9.0.md)]
80
68
81
69
The logs show the service listening on `https://localhost:<port>`, where `<port>` is the localhost port number randomly assigned when the project is created and set in `Properties/launchSettings.json`.
* In the preceding highlighted code, replace the localhost port number `7042` with the `HTTPS` port number specified in `Properties/launchSettings.json` within the `GrpcGreeter` service project.
242
209
@@ -247,33 +214,28 @@ The Greeter client is created by:
247
214
* Instantiating a `GrpcChannel` containing the information for creating the connection to the gRPC service.
248
215
* Using the `GrpcChannel` to construct the Greeter client:
* In the Greeter service, press `Ctrl+F5` to start the server without the debugger.
265
-
* In the `GrpcGreeterClient` project, press `Ctrl+F5` to start the client without the debugger.
231
+
* In the `GrpcGreeter` service project, press `Ctrl+F5` to start the server without the debugger.
232
+
* In the `GrpcGreeterClient`console project, press `Ctrl+F5` to start the client without the debugger.
266
233
267
234
# [Visual Studio Code](#tab/visual-studio-code)
268
235
269
236
* Start the Greeter service.
270
237
* Start the client.
271
238
272
-
# [Visual Studio for Mac](#tab/visual-studio-mac)
273
-
274
-
* Start the Greeter service.
275
-
* Start the client.
276
-
277
239
---
278
240
279
241
The client sends a greeting to the service with a message containing its name, *GreeterClient*. The service sends the message "Hello GreeterClient" as a response. The "Hello GreeterClient" response is displayed in the command prompt:
0 commit comments