Skip to content

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...

@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