mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-17 21:44:48 -04:00
Compare commits
3 Commits
v2.0.0.509
...
v2.0.1.510
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86b81948af | ||
|
|
54918e0c30 | ||
|
|
01dd793c0a |
@@ -9,7 +9,7 @@ variables:
|
||||
testsFolder: './_tests'
|
||||
yarnCacheFolder: $(Pipeline.Workspace)/.yarn
|
||||
nugetCacheFolder: $(Pipeline.Workspace)/.nuget/packages
|
||||
majorVersion: '2.0.0'
|
||||
majorVersion: '2.0.1'
|
||||
minorVersion: $[counter('minorVersion', 1)]
|
||||
prowlarrVersion: '$(majorVersion).$(minorVersion)'
|
||||
buildName: '$(Build.SourceBranchName).$(prowlarrVersion)'
|
||||
|
||||
@@ -211,9 +211,20 @@ namespace NzbDrone.Core.Configuration
|
||||
return AuthenticationType.Forms;
|
||||
}
|
||||
|
||||
return Enum.TryParse<AuthenticationType>(_authOptions.Method, out var enumValue)
|
||||
var value = Enum.TryParse<AuthenticationType>(_authOptions.Method, out var enumValue)
|
||||
? enumValue
|
||||
: GetValueEnum("AuthenticationMethod", AuthenticationType.None);
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
if (value == AuthenticationType.Basic)
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
{
|
||||
SetValue("AuthenticationMethod", AuthenticationType.Forms);
|
||||
|
||||
return AuthenticationType.Forms;
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,6 +400,12 @@ namespace NzbDrone.Core.Configuration
|
||||
{
|
||||
SetValue("EnableSsl", false);
|
||||
}
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
if (AuthenticationMethod == AuthenticationType.Basic)
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
{
|
||||
SetValue("AuthenticationMethod", AuthenticationType.Forms);
|
||||
}
|
||||
}
|
||||
|
||||
private void DeleteOldValues()
|
||||
|
||||
@@ -2,8 +2,6 @@ using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.Extensions.Options;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Authentication;
|
||||
using NzbDrone.Core.Configuration;
|
||||
|
||||
namespace Prowlarr.Http.Authentication
|
||||
@@ -12,17 +10,14 @@ namespace Prowlarr.Http.Authentication
|
||||
{
|
||||
private const string PolicyName = "UI";
|
||||
private readonly IConfigFileProvider _config;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public DefaultAuthorizationPolicyProvider FallbackPolicyProvider { get; }
|
||||
|
||||
public UiAuthorizationPolicyProvider(IOptions<AuthorizationOptions> options,
|
||||
IConfigFileProvider config,
|
||||
Logger logger)
|
||||
IConfigFileProvider config)
|
||||
{
|
||||
FallbackPolicyProvider = new DefaultAuthorizationPolicyProvider(options);
|
||||
_config = config;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Task<AuthorizationPolicy> GetDefaultPolicyAsync() => FallbackPolicyProvider.GetDefaultPolicyAsync();
|
||||
@@ -33,19 +28,7 @@ namespace Prowlarr.Http.Authentication
|
||||
{
|
||||
if (policyName.Equals(PolicyName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var authenticationMethod = _config.AuthenticationMethod;
|
||||
|
||||
#pragma warning disable CS0618 // Type or member is obsolete
|
||||
if (authenticationMethod == AuthenticationType.Basic)
|
||||
#pragma warning restore CS0618 // Type or member is obsolete
|
||||
{
|
||||
_logger.Error("Basic authentication method was removed, use Forms authentication instead.");
|
||||
|
||||
authenticationMethod = AuthenticationType.Forms;
|
||||
}
|
||||
|
||||
var policy = new AuthorizationPolicyBuilder()
|
||||
.AddAuthenticationSchemes(authenticationMethod.ToString())
|
||||
var policy = new AuthorizationPolicyBuilder(_config.AuthenticationMethod.ToString())
|
||||
.AddRequirements(new BypassableDenyAnonymousAuthorizationRequirement());
|
||||
|
||||
return Task.FromResult(policy.Build());
|
||||
|
||||
Reference in New Issue
Block a user