fixed authentication.
This commit is contained in:
parent
028bd5251c
commit
3bed87ec4e
|
@ -1,10 +1,7 @@
|
||||||
using System;
|
using Nancy.Authentication.Basic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Nancy.Authentication.Basic;
|
|
||||||
using Nancy.Security;
|
using Nancy.Security;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Common.Model;
|
||||||
|
|
||||||
namespace NzbDrone.Api.Authentication
|
namespace NzbDrone.Api.Authentication
|
||||||
{
|
{
|
||||||
|
@ -19,6 +16,11 @@ namespace NzbDrone.Api.Authentication
|
||||||
|
|
||||||
public IUserIdentity Validate(string username, string password)
|
public IUserIdentity Validate(string username, string password)
|
||||||
{
|
{
|
||||||
|
if (_configFileProvider.AuthenticationType == AuthenticationType.Anonymous)
|
||||||
|
{
|
||||||
|
return new NzbDroneUser { UserName = "Anonymous" };
|
||||||
|
}
|
||||||
|
|
||||||
if (_configFileProvider.BasicAuthUsername.Equals(username) &&
|
if (_configFileProvider.BasicAuthUsername.Equals(username) &&
|
||||||
_configFileProvider.BasicAuthPassword.Equals(password))
|
_configFileProvider.BasicAuthPassword.Equals(password))
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,12 +39,9 @@ namespace NzbDrone.Api
|
||||||
|
|
||||||
container.Resolve<IMessageAggregator>().PublishEvent(new ApplicationStartedEvent());
|
container.Resolve<IMessageAggregator>().PublishEvent(new ApplicationStartedEvent());
|
||||||
|
|
||||||
if (container.Resolve<IConfigFileProvider>().AuthenticationType == AuthenticationType.Basic)
|
|
||||||
{
|
|
||||||
pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(
|
pipelines.EnableBasicAuthentication(new BasicAuthenticationConfiguration(
|
||||||
container.Resolve<IUserValidator>(),
|
container.Resolve<IUserValidator>(),
|
||||||
"NzbDrone"));
|
"NzbDrone"));
|
||||||
}
|
|
||||||
|
|
||||||
ApplicationPipelines.OnError.AddItemToEndOfPipeline(container.Resolve<NzbDroneErrorPipeline>().HandleException);
|
ApplicationPipelines.OnError.AddItemToEndOfPipeline(container.Resolve<NzbDroneErrorPipeline>().HandleException);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue