Blazor: Implementing the Role Based Routing in Blazor WebAssembly
In this article we will implement the Role-Based routing in Blazor WebAssembly application. In previous article , I have explained the Token Based Authentication and Policy-Based Authorization. In that article, I have explained the mechanism of using the UserName and RoleName in the JSON Web Token (JWT) claims. In the current article, we will use the same API project (I have provided the link at the end of this article.) for security and the Blazor WebAssembly project will invoke the API endpoints securely. Figure 1 shows the implementation guideline. Figure 1: The Implementation As shown in Figure 1, the execution takes place as follows: The Blazor WebAssembly client application make call to API application by sending the credentials. The API application generate JSON Web Token based on UserName and RoleName. The Token along with the UserName and RoleName is send to the client. The Blazor Application saves the Token UserName, and RoleName to Session Storage. Blazor WebAssembly cli...