Skip to content

Change examples to use WebApplication V4#1879

Merged
JamesNK merged 2 commits into
grpc:masterfrom
JamesNK:jamesnk/examples/webapp-v4
Sep 13, 2022
Merged

Change examples to use WebApplication V4#1879
JamesNK merged 2 commits into
grpc:masterfrom
JamesNK:jamesnk/examples/webapp-v4

Conversation

@JamesNK

@JamesNK JamesNK commented Sep 9, 2022

Copy link
Copy Markdown
Member

Done

builder.Services.AddGrpc();
builder.Services.AddSingleton<TicketRepository>();

builder.Services.AddAuthorization(options =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered using the new AuthorizationBuilder model here. Should be something like this:

services.AddAuthorization().AddPolicy(
  JwtBearerDefaults.AuthenticationScheme,
  policy => {
    policy.AddAuthenticationSchemes(JwtBearerDefaults.AuthenticationScheme);
    policy.RequireClaim(ClaimTypes.Name);
  });

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't available for me. Perhaps the .NET 7 version with it isn't out yet.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting...they should've been a part of the preview7 release...

In any case, not a huge deal...

Comment thread examples/Ticketer/Server/Program.cs Outdated
Comment thread examples/Ticketer/Server/Program.cs Outdated
@JamesNK JamesNK force-pushed the jamesnk/examples/webapp-v4 branch from 8d023fb to 047c9eb Compare September 13, 2022 02:35
@JamesNK JamesNK force-pushed the jamesnk/examples/webapp-v4 branch from 8f7762f to 3833830 Compare September 13, 2022 04:07
@JamesNK JamesNK merged commit 54fa142 into grpc:master Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants