mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 03:48:06 +02:00
updated service stack
This commit is contained in:
parent
a4b75934e5
commit
4edcab9c11
4 changed files with 20 additions and 6 deletions
|
@ -4,6 +4,7 @@ using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Controller.Security;
|
using MediaBrowser.Controller.Security;
|
||||||
|
using MediaBrowser.Controller.Session;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -14,10 +15,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
|
||||||
{
|
{
|
||||||
private readonly IServerConfigurationManager _config;
|
private readonly IServerConfigurationManager _config;
|
||||||
|
|
||||||
public AuthService(IUserManager userManager, IAuthorizationContext authorizationContext, IServerConfigurationManager config, IConnectManager connectManager)
|
public AuthService(IUserManager userManager, IAuthorizationContext authorizationContext, IServerConfigurationManager config, IConnectManager connectManager, ISessionManager sessionManager)
|
||||||
{
|
{
|
||||||
AuthorizationContext = authorizationContext;
|
AuthorizationContext = authorizationContext;
|
||||||
_config = config;
|
_config = config;
|
||||||
|
SessionManager = sessionManager;
|
||||||
ConnectManager = connectManager;
|
ConnectManager = connectManager;
|
||||||
UserManager = userManager;
|
UserManager = userManager;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +27,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
|
||||||
public IUserManager UserManager { get; private set; }
|
public IUserManager UserManager { get; private set; }
|
||||||
public IAuthorizationContext AuthorizationContext { get; private set; }
|
public IAuthorizationContext AuthorizationContext { get; private set; }
|
||||||
public IConnectManager ConnectManager { get; private set; }
|
public IConnectManager ConnectManager { get; private set; }
|
||||||
|
public ISessionManager SessionManager { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Redirect the client to a specific URL if authentication failed.
|
/// Redirect the client to a specific URL if authentication failed.
|
||||||
|
@ -91,6 +94,18 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security
|
||||||
|
|
||||||
ValidateRoles(roles, user);
|
ValidateRoles(roles, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(auth.DeviceId) &&
|
||||||
|
!string.IsNullOrWhiteSpace(auth.Client) &&
|
||||||
|
!string.IsNullOrWhiteSpace(auth.Device))
|
||||||
|
{
|
||||||
|
SessionManager.LogSessionActivity(auth.Client,
|
||||||
|
auth.Version,
|
||||||
|
auth.DeviceId,
|
||||||
|
auth.Device,
|
||||||
|
request.RemoteIp,
|
||||||
|
user);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsExemptFromAuthenticationToken(AuthorizationInfo auth, IAuthenticationAttributes authAttribtues)
|
private bool IsExemptFromAuthenticationToken(AuthorizationInfo auth, IAuthenticationAttributes authAttribtues)
|
||||||
|
|
|
@ -140,5 +140,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
|
||||||
get { return response.SendChunked; }
|
get { return response.SendChunked; }
|
||||||
set { response.SendChunked = value; }
|
set { response.SendChunked = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool KeepAlive { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net" />
|
||||||
<Reference Include="System.Security" />
|
<Reference Include="System.Security" />
|
||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
|
@ -408,10 +409,6 @@
|
||||||
<EmbeddedResource Include="Localization\Ratings\ca.txt" />
|
<EmbeddedResource Include="Localization\Ratings\ca.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\highlight.default.css">
|
|
||||||
<Link>swagger-ui\css\highlight.default.css</Link>
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\screen.css">
|
<Content Include="..\ThirdParty\ServiceStack\swagger-ui\css\screen.css">
|
||||||
<Link>swagger-ui\css\screen.css</Link>
|
<Link>swagger-ui\css\screen.css</Link>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
|
|
@ -499,7 +499,7 @@ namespace MediaBrowser.Server.Startup.Common
|
||||||
var authContext = new AuthorizationContext(AuthenticationRepository);
|
var authContext = new AuthorizationContext(AuthenticationRepository);
|
||||||
RegisterSingleInstance<IAuthorizationContext>(authContext);
|
RegisterSingleInstance<IAuthorizationContext>(authContext);
|
||||||
RegisterSingleInstance<ISessionContext>(new SessionContext(UserManager, authContext, SessionManager));
|
RegisterSingleInstance<ISessionContext>(new SessionContext(UserManager, authContext, SessionManager));
|
||||||
RegisterSingleInstance<IAuthService>(new AuthService(UserManager, authContext, ServerConfigurationManager, ConnectManager));
|
RegisterSingleInstance<IAuthService>(new AuthService(UserManager, authContext, ServerConfigurationManager, ConnectManager, SessionManager));
|
||||||
|
|
||||||
RegisterSingleInstance<ISubtitleEncoder>(new SubtitleEncoder(LibraryManager, LogManager.GetLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer));
|
RegisterSingleInstance<ISubtitleEncoder>(new SubtitleEncoder(LibraryManager, LogManager.GetLogger("SubtitleEncoder"), ApplicationPaths, FileSystemManager, MediaEncoder, JsonSerializer));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue