mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-04-28 07:40:50 +02:00
Fixed: Redirect loop for removed basic auth method
This commit is contained in:
parent
47a7b15161
commit
bee3e61f53
1 changed files with 5 additions and 8 deletions
|
|
@ -11,7 +11,7 @@ namespace Prowlarr.Http.Authentication
|
|||
{
|
||||
public static class AuthenticationBuilderExtensions
|
||||
{
|
||||
private static readonly Regex CookieNameRegex = new Regex(@"[^a-z0-9]+", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
private static readonly Regex CookieNameRegex = new(@"[^a-z0-9]+", RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
||||
|
||||
public static AuthenticationBuilder AddApiKey(this AuthenticationBuilder authenticationBuilder, string name, Action<ApiKeyAuthenticationOptions> options)
|
||||
{
|
||||
|
|
@ -30,7 +30,7 @@ public static AuthenticationBuilder AddExternal(this AuthenticationBuilder authe
|
|||
|
||||
public static AuthenticationBuilder AddAppAuthentication(this IServiceCollection services)
|
||||
{
|
||||
services.AddOptions<CookieAuthenticationOptions>(AuthenticationType.Forms.ToString())
|
||||
services.AddOptions<CookieAuthenticationOptions>(nameof(AuthenticationType.Forms))
|
||||
.Configure<IConfigFileProvider>((options, configFileProvider) =>
|
||||
{
|
||||
// Replace diacritics and replace non-word characters to ensure cookie name doesn't contain any valid URL characters not allowed in cookie names
|
||||
|
|
@ -47,12 +47,9 @@ public static AuthenticationBuilder AddAppAuthentication(this IServiceCollection
|
|||
});
|
||||
|
||||
return services.AddAuthentication()
|
||||
.AddNone(AuthenticationType.None.ToString())
|
||||
.AddExternal(AuthenticationType.External.ToString())
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
.AddCookie(AuthenticationType.Basic.ToString())
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
.AddCookie(AuthenticationType.Forms.ToString())
|
||||
.AddNone(nameof(AuthenticationType.None))
|
||||
.AddExternal(nameof(AuthenticationType.External))
|
||||
.AddCookie(nameof(AuthenticationType.Forms))
|
||||
.AddApiKey("API", options =>
|
||||
{
|
||||
options.HeaderName = "X-Api-Key";
|
||||
|
|
|
|||
Loading…
Reference in a new issue