It's thanks.
but there is small problem.
when I visit website it will direct redirect me to auth website login
i just want to be specified page to be authorize not every.
this app.razor
----------
<CascadingAuthenticationState>
<Router AppAssembly="@typeof(Program).Assembly">
<Found Context="routeData">
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(ProfileLayout)">
<Authorizing>
<div class="d-flex align-items-center justify-content-center flex-column vh-100">
<div class="spinner-border" role="status">
<span class="sr-only">Loading..</span>
</div>
<p class="text-center mt-2">Authorizing</p>
</div>
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Authorizing>
<NotAuthorized>
<RedirectToLogin />
@*//@if (!context.User.Identity.IsAuthenticated)
{
}
else
{
<p>You are not authorized to access this resource.</p>
}*@
</NotAuthorized>
</AuthorizeRouteView>
</Found>
<NotFound>
<LayoutView Layout="@typeof(ProfileLayout)">
nothing 404
</LayoutView>
</NotFound>
</Router>
</CascadingAuthenticationState>
Also I dont see logged in user name/email
I call it as context.User.Identity.Name nothing showup also I tried it by calling IHttpContextAccessor nothing happened.