Merge branch 'release/1.0.0' of github.com:ONLYOFFICE/AppServer into release/1.0.0
@ -4,6 +4,7 @@ using System.Text.Encodings.Web;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ASC.Core;
|
||||
using ASC.Web.Core;
|
||||
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -13,23 +14,32 @@ namespace ASC.Api.Core.Auth
|
||||
{
|
||||
public class CookieAuthHandler : AuthenticationHandler<AuthenticationSchemeOptions>
|
||||
{
|
||||
private SecurityContext SecurityContext { get; }
|
||||
private CookiesManager CookiesManager { get; }
|
||||
|
||||
public CookieAuthHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock) : base(options, logger, encoder, clock)
|
||||
{
|
||||
}
|
||||
//
|
||||
public CookieAuthHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, SecurityContext securityContext)
|
||||
public CookieAuthHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, SecurityContext securityContext, CookiesManager cookiesManager)
|
||||
: this(options, logger, encoder, clock)
|
||||
{
|
||||
SecurityContext = securityContext;
|
||||
CookiesManager = cookiesManager;
|
||||
}
|
||||
|
||||
private SecurityContext SecurityContext { get; }
|
||||
|
||||
protected override Task<AuthenticateResult> HandleAuthenticateAsync()
|
||||
{
|
||||
var token = Context.Request.Cookies["asc_auth_key"] ?? Context.Request.Headers["Authorization"];
|
||||
var result = SecurityContext.AuthenticateMe(token);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
SecurityContext.Logout();
|
||||
CookiesManager.ClearCookies(CookiesType.AuthKey);
|
||||
CookiesManager.ClearCookies(CookiesType.SocketIO);
|
||||
}
|
||||
|
||||
return Task.FromResult(
|
||||
result ?
|
||||
AuthenticateResult.Success(new AuthenticationTicket(Context.User, new AuthenticationProperties(), Scheme.Name)) :
|
||||
|
@ -49,7 +49,7 @@ class ArticleMainButtonContent extends React.Component {
|
||||
|
||||
onFileChange = (e) => {
|
||||
const { startUpload, t } = this.props;
|
||||
this.goToHomePage();
|
||||
//this.goToHomePage();
|
||||
startUpload(e.target.files, null, t);
|
||||
};
|
||||
|
||||
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 144 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |