Contribute to Docs Contribute to Docs

Simple Authentication

The Simple Security implementation is a simple user & authentication manager for development purposes. It does not persist any user data, instead the current user accounts are added into memory on application startup. It is not recommended to use Simple Security for production environments.

Simple Security depends on the HttpContext in order to sign in a user and can't be used for other types of applications.

Installation

The Simple Security can be installed by adding the NuGet package:

<PackageReference Include="Piranha.AspNetCore.SimpleSecurity" Version="7.0.0" />

Registering The Service

You register Simple Security in ConfigureServices() with the following call:

services.AddPiranhaSimpleSecurity(
    new Piranha.AspNetCore.SimpleUser(Piranha.Manager.Permission.All())
    {
        UserName = "admin",
        Password = "password"
    },
    ...
);

Here you can create any number of users with different permissions that you need for your development environment.