This is a migrated thread and some comments may be shown as answers.

Blazor Menu - AuthorizeView

1 Answer 995 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Rob Anderson
Top achievements
Rank 1
Rob Anderson asked on 27 Apr 2020, 02:46 PM

How do I integrate Authentication/Authorization with the TelerikMenu for Blazor?  I don't see any options.

I'd like to allow on certain menu items based on user authentication.  Like this:

 

        <AuthorizeView>
            <Authorized>
                <NavLink class="list-group-item list-group-item-action bg-light"
                         href="/" Match="NavLinkMatch.All">
                    <span class="oi oi-home" aria-hidden="true"></span> Home
                </NavLink>
                <NavLink class="list-group-item list-group-item-action bg-light"
                         href="/employeeoverview">
                    <span class="oi oi-list-rich" aria-hidden="true"></span> Employees
                </NavLink>
                <NavLink class="list-group-item list-group-item-action bg-light"
                         href="/employeeedit">
                    <span class="oi oi-list-rich" aria-hidden="true"></span> Add new employee
                </NavLink>
                <NavLink class="list-group-item list-group-item-action bg-light"
                         href="Logout">
                    <span class="oi oi-list-rich" aria-hidden="true"></span> Log out 
                    (@context.User.Claims.FirstOrDefault(c => c.Type
                    == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name")?.Value)
                </NavLink>
            </Authorized>
            <NotAuthorized>
                <NavLink class="list-group-item list-group-item-action bg-light"
                         href="Login">
                    <span class="oi oi-list-rich" aria-hidden="true"></span> Log in
                </NavLink>
            </NotAuthorized>
        </AuthorizeView>

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 27 Apr 2020, 03:27 PM

Hi Rob,

I made the following article that explains the situation: https://docs.telerik.com/blazor-ui/knowledge-base/menu-authorize-view.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Menu
Asked by
Rob Anderson
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or