Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

What are the security risks in using a simple @if for authentication in blazor server?

$
0
0

Lets say i have a razor page where i use a simple @if(SimpleAuth.IsAdmin) to show it if the user is an admin.

@inject SimpleAuth SimpleAuth@if(SimpleAuth.IsAdmin) {<p>protected content</p>}

I have the SimpleAuth.cs handling the authentication which will set

public bool IsAdmin {get; private set;} = false;

based on some authentication mechanism.

I add the SimpleAuth service as

builder.Services.AddScoped<SimpleAuth>();

Provided this is a blazor server project can this be bypassed by the client without say having a flaw in the auth mechanism itself ?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>