“Sampel Blazor Kebijakan Cliam Ujsing” Kode Jawaban

Sampel Blazor Kebijakan Cliam Ujsing

public void ConfigureServices(IServiceCollection services)
{
    services.AddAuthorization(config =>
    {
        config.AddPolicy("IsDeveloper", policy => policy.RequireClaim("IsDeveloper", "true"));
    });
}
Magnificent Markhor

Sampel Blazor Kebijakan Cliam Ujsing

@page "/debug"
@attribute [Authorize(Policy = "IsDeveloper")]
Magnificent Markhor

Sampel Blazor Kebijakan Cliam Ujsing

[Route("api/[controller]")]
[ApiController]
public class SystemController 
{
    [Authorize(Policy = “IsDeveloper”)]
    public IActionResult LoadDebugInfo()
    {
        // ...
    }
}
Magnificent Markhor

Sampel Blazor Kebijakan Cliam Ujsing

<AuthorizeView Policy="IsDeveloper">
    <p>You can only see this if you satisfy the IsDeveloper policy.</p>
</AuthorizeView>
Magnificent Markhor

Jawaban yang mirip dengan “Sampel Blazor Kebijakan Cliam Ujsing”

Pertanyaan yang mirip dengan “Sampel Blazor Kebijakan Cliam Ujsing”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya