New: Forms authentication

This commit is contained in:
Mark McDowall 2015-01-25 18:03:21 -08:00
parent 7c38fcb9f3
commit 3c756348eb
35 changed files with 707 additions and 81 deletions

View file

@ -9,6 +9,7 @@ using NzbDrone.Common.Cache;
using NzbDrone.Common.Disk;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Authentication;
using NzbDrone.Core.Configuration.Events;
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Messaging.Commands;
@ -29,14 +30,11 @@ namespace NzbDrone.Core.Configuration
int SslPort { get; }
bool EnableSsl { get; }
bool LaunchBrowser { get; }
bool AuthenticationEnabled { get; }
AuthenticationType AuthenticationMethod { get; }
bool AnalyticsEnabled { get; }
string Username { get; }
string Password { get; }
string LogLevel { get; }
string Branch { get; }
string ApiKey { get; }
bool Torrent { get; }
string SslCertHash { get; }
string UrlBase { get; }
Boolean UpdateAutomatically { get; }
@ -163,14 +161,20 @@ namespace NzbDrone.Core.Configuration
}
}
public bool Torrent
public AuthenticationType AuthenticationMethod
{
get { return GetValueBoolean("Torrent", false, persist: false); }
}
get
{
var enabled = GetValueBoolean("AuthenticationEnabled", false, false);
public bool AuthenticationEnabled
{
get { return GetValueBoolean("AuthenticationEnabled", false); }
if (enabled)
{
SetValue("AuthenticationMethod", AuthenticationType.Basic);
return AuthenticationType.Basic;
}
return GetValueEnum("AuthenticationMethod", AuthenticationType.None);
}
}
public bool AnalyticsEnabled
@ -186,16 +190,6 @@ namespace NzbDrone.Core.Configuration
get { return GetValue("Branch", "master").ToLowerInvariant(); }
}
public string Username
{
get { return GetValue("Username", ""); }
}
public string Password
{
get { return GetValue("Password", ""); }
}
public string LogLevel
{
get { return GetValue("LogLevel", "Info"); }