dotnet / dotnet/aspnetcore

[API Proposal]: Allow to configure the login path in Identity

Open
#49,450 0 comments 1 reaction 0 assignees View on GitHub
api-suggestion area-identity enhancement
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

## Background and Motivation

Currently it doesn't seem to be an easy and built-in way to customise the login url used by the default authentication scheme in `Identity` apart from reconfiguring the scheme itself.

https://github.com/dotnet/aspnetcore/blob/240377059ec25b4d9d86d4188a26722e55edc5a1/src/Identity/Core/src/IdentityServiceCollectionExtensions.cs#L61-L61

## Proposed API

```diff
namespace Microsoft.AspNetCore.Identity;

public partial class SignInOptions
{
+ public string LoginPath { get; set; } = "/Account/Login";
}
```

## Usage Examples

```c#
builder.Services.Configure(options =>
{
options.SignIn.LoginPath = "/login";
});
```

## Risks

Nothing I can see now as the behaviour will remain the same thanks to the default value which is the same as the one used today.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.