Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change examples to use WebApplication V4 #1879

Merged
merged 2 commits into from
Sep 13, 2022

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Sep 9, 2022

Done

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

builder.Services.AddAuthorization(options =>
Copy link
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
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
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...

examples/Ticketer/Server/Program.cs Outdated Show resolved Hide resolved
examples/Ticketer/Server/Program.cs Outdated Show resolved Hide resolved
@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.

None yet

2 participants