Select theme:
Radzen Blazor Studio supports Windows authentication and authorization.
Windows authentication support is enabled only on Windows machines.
To enable Windows securityDirectory support in Radzen Blazor Studio follow these steps.
When security is enabled Radzen Blazor Studio will allow you to specify which users can access a page. If a user doesn’t have access to certain page it will not appear in the application navigation. If the user enters that page URL manually in the browser they will see a generated unauthorized page.
By default pages created in Radzen Blazor Studio allow access to Everyone - both authenticated and anonymous users.
To specify who can access a page:
Administrator
.The code generated for this example is:
@attribute [Authorize(Roles="Administrator")]
Important: If you assign a group to a user make sure they log out fro the application and log in again to see the changes.
Radzen Blazor Studio applications use various controllers to access data over HTTP - AccountController for login, registration, ApplicationUsersController and ApplicationRolesController to manage users and roles. Blazor WASM expose a database as a OData controller. By default only ApplicationRolesController and ApplicationUsersController disallow anonymous access.
To require authorized access you need to decorate the controllers with the Authorize attribute.
To disable anonymous access and allow any logged-in user edit the controller code and add [Authorize]
before the class declaration.
/* snip */
using Microsoft.AspNetCore.Authorization;
namespace [Namespace].Server.Controllers.[Database]
{
[Authorize] // -> Allow any authenticated user. Disallow anonymous access.
[Route("odata/Northwind/Orders")]
public partial class OrdersController : ODataController
{
/* snip */
}
}
Important: Do not add the
Authorize
attribute to the AccountController class as it will effectively disable login and registration.
To allow only certain roles specify the Roles property during decoration:
/* snip */
using Microsoft.AspNetCore.Authorization;
namespace [Namespace].Server.Controllers.[Database]
{
[Authorize(Roles="Administrator,Sales")] // -> Allow only members of the Administrator or Sales role
[Route("odata/Northwind/Orders")]
public partial class OrdersController : ODataController
{
/* snip */
}
}
Radzen is free to use. You can also test the premium features for 15 days.
Download NowSelect theme: