Let’s assume you have configured Blazor authentication and authorization in your project, and you want to access the username/claim in your view. Then, you can wrap the component into AuthorizeView
and access the User details from the @context property.
@context property will be not available if the component is not inside the AuthorizeView
<AuthorizeView>
Hello, @context.User.Identity.Name!
</AuthorizeView>