diff --git a/src/Squidex.Events/Apps/AppClientAttached.cs b/src/Squidex.Events/Apps/AppClientAttached.cs index 5d4e80362..fad4224f0 100644 --- a/src/Squidex.Events/Apps/AppClientAttached.cs +++ b/src/Squidex.Events/Apps/AppClientAttached.cs @@ -6,7 +6,6 @@ // All rights reserved. // ========================================================================== -using System; using Squidex.Infrastructure; namespace Squidex.Events.Apps @@ -17,7 +16,5 @@ namespace Squidex.Events.Apps public string Id { get; set; } public string Secret { get; set; } - - public DateTime ExpiresUtc { get; set; } } } diff --git a/src/Squidex.Infrastructure/CQRS/IAggregate.cs b/src/Squidex.Infrastructure/CQRS/IAggregate.cs index bf4b70d73..adacdb095 100644 --- a/src/Squidex.Infrastructure/CQRS/IAggregate.cs +++ b/src/Squidex.Infrastructure/CQRS/IAggregate.cs @@ -24,6 +24,4 @@ namespace Squidex.Infrastructure.CQRS ICollection> GetUncomittedEvents(); } -} - - +} \ No newline at end of file diff --git a/src/Squidex.Write/Apps/AppClient.cs b/src/Squidex.Write/Apps/AppClient.cs index 15c6f1761..03817cce0 100644 --- a/src/Squidex.Write/Apps/AppClient.cs +++ b/src/Squidex.Write/Apps/AppClient.cs @@ -6,7 +6,6 @@ // All rights reserved. // ========================================================================== -using System; using Squidex.Infrastructure; namespace Squidex.Write.Apps @@ -16,7 +15,6 @@ namespace Squidex.Write.Apps private readonly string name; private readonly string id; private readonly string secret; - private readonly DateTime expiresUtc; public string Id { @@ -33,12 +31,7 @@ namespace Squidex.Write.Apps get { return secret; } } - public DateTime ExpiresUtc - { - get { return expiresUtc; } - } - - public AppClient(string id, string secret, DateTime expiresUtc, string name = null) + public AppClient(string id, string secret, string name = null) { Guard.NotNullOrEmpty(id, nameof(id)); Guard.NotNullOrEmpty(secret, nameof(secret)); @@ -46,12 +39,11 @@ namespace Squidex.Write.Apps this.id = id; this.name = name; this.secret = secret; - this.expiresUtc = expiresUtc; } public AppClient Rename(string newName) { - return new AppClient(Id, Secret, ExpiresUtc, newName); + return new AppClient(Id, Secret, newName); } } } diff --git a/src/Squidex.Write/Apps/AppClients.cs b/src/Squidex.Write/Apps/AppClients.cs index 2bf58d626..8208f295c 100644 --- a/src/Squidex.Write/Apps/AppClients.cs +++ b/src/Squidex.Write/Apps/AppClients.cs @@ -23,11 +23,11 @@ namespace Squidex.Write.Apps get { return clients; } } - public void Add(string id, string secret, DateTime expires) + public void Add(string id, string secret) { ThrowIfFound(id, () => "Cannot rename client"); - clients[id] = new AppClient(id, secret, expires); + clients[id] = new AppClient(id, secret); } public void Rename(string clientId, string name) diff --git a/src/Squidex.Write/Apps/AppCommandHandler.cs b/src/Squidex.Write/Apps/AppCommandHandler.cs index 5307ca7ff..d77de95f9 100644 --- a/src/Squidex.Write/Apps/AppCommandHandler.cs +++ b/src/Squidex.Write/Apps/AppCommandHandler.cs @@ -80,7 +80,7 @@ namespace Squidex.Write.Apps { return handler.UpdateAsync(command, x => { - x.AttachClient(command, keyGenerator.GenerateKey(), command.Timestamp.AddYears(1)); + x.AttachClient(command, keyGenerator.GenerateKey()); context.Succeed(x.Clients[command.Id]); }); diff --git a/src/Squidex.Write/Apps/AppDomainObject.cs b/src/Squidex.Write/Apps/AppDomainObject.cs index 9fe4a8ef2..3e9e5f2c7 100644 --- a/src/Squidex.Write/Apps/AppDomainObject.cs +++ b/src/Squidex.Write/Apps/AppDomainObject.cs @@ -62,7 +62,7 @@ namespace Squidex.Write.Apps protected void On(AppClientAttached @event) { - clients.Add(@event.Id, @event.Secret, @event.ExpiresUtc); + clients.Add(@event.Id, @event.Secret); } protected void On(AppClientRenamed @event) @@ -134,13 +134,13 @@ namespace Squidex.Write.Apps return this; } - public AppDomainObject AttachClient(AttachClient command, string secret, DateTime expiresUtc) + public AppDomainObject AttachClient(AttachClient command, string secret) { Guard.Valid(command, nameof(command), () => "Cannot attach client"); ThrowIfNotCreated(); - RaiseEvent(SimpleMapper.Map(command, new AppClientAttached { Secret = secret, ExpiresUtc = expiresUtc })); + RaiseEvent(SimpleMapper.Map(command, new AppClientAttached { Secret = secret })); return this; } diff --git a/src/Squidex/Config/Domain/WriteModule.cs b/src/Squidex/Config/Domain/WriteModule.cs index 0369345e2..767a48e86 100644 --- a/src/Squidex/Config/Domain/WriteModule.cs +++ b/src/Squidex/Config/Domain/WriteModule.cs @@ -45,22 +45,18 @@ namespace Squidex.Config.Domain .As() .SingleInstance(); - builder.RegisterType() .As() .SingleInstance(); - builder.RegisterType() .AsSelf() .SingleInstance(); - builder.RegisterType() .AsSelf() .SingleInstance(); - builder.RegisterType() .As() .SingleInstance(); @@ -73,7 +69,6 @@ namespace Squidex.Config.Domain .As() .SingleInstance(); - builder.Register>(c => (id => new AppDomainObject(id, 0))) .AsSelf() .SingleInstance(); diff --git a/src/Squidex/Controllers/Api/Apps/Models/ClientDto.cs b/src/Squidex/Controllers/Api/Apps/Models/ClientDto.cs index 32ec5b5be..50bc49ea9 100644 --- a/src/Squidex/Controllers/Api/Apps/Models/ClientDto.cs +++ b/src/Squidex/Controllers/Api/Apps/Models/ClientDto.cs @@ -30,11 +30,5 @@ namespace Squidex.Controllers.Api.Apps.Models /// [Required] public string Name { get; set; } - - /// - /// The date and time when the client key expires. - /// - [Required] - public DateTime ExpiresUtc { get; set; } } } diff --git a/src/Squidex/Controllers/UI/Account/AccountController.cs b/src/Squidex/Controllers/UI/Account/AccountController.cs index b36ce7117..3e160cb73 100644 --- a/src/Squidex/Controllers/UI/Account/AccountController.cs +++ b/src/Squidex/Controllers/UI/Account/AccountController.cs @@ -84,6 +84,13 @@ namespace Squidex.Controllers.UI.Account return View(); } + [HttpGet] + [Route("account/logout-completed/")] + public IActionResult LogoutCompleted() + { + return View(); + } + [HttpGet] [Route("account/error/")] public IActionResult Error() @@ -109,6 +116,15 @@ namespace Squidex.Controllers.UI.Account return Redirect(logoutUrl); } + [HttpGet] + [Route("account/logout-redirect/")] + public async Task LogoutRedirect() + { + await signInManager.SignOutAsync(); + + return RedirectToAction(nameof(LogoutCompleted)); + } + [HttpGet] [Route("account/login/")] public IActionResult Login(string returnUrl = null) diff --git a/src/Squidex/Views/Account/LockedOut.cshtml b/src/Squidex/Views/Account/LockedOut.cshtml index ed7e526e1..7c59a141f 100644 --- a/src/Squidex/Views/Account/LockedOut.cshtml +++ b/src/Squidex/Views/Account/LockedOut.cshtml @@ -16,5 +16,9 @@

Your account is locked, please contact the administrator.

+ +

+ Logout +

\ No newline at end of file diff --git a/src/Squidex/Views/Account/LogoutCompleted.cshtml b/src/Squidex/Views/Account/LogoutCompleted.cshtml new file mode 100644 index 000000000..92f8d9178 --- /dev/null +++ b/src/Squidex/Views/Account/LogoutCompleted.cshtml @@ -0,0 +1,20 @@ + + + + + + + + + Squidex - Logout + + + + +

Logged out!

+ +

+ Please close this popup. +

+ + \ No newline at end of file diff --git a/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts b/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts index 763465659..1817ffaa5 100644 --- a/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts +++ b/src/Squidex/app/features/schemas/pages/schemas/schemas-page.component.ts @@ -133,4 +133,3 @@ function updateSchema(schema: SchemaDto, authService: AuthService, message: Sche schema.created, DateTime.now()); } - diff --git a/src/Squidex/app/features/settings/pages/clients/client.component.html b/src/Squidex/app/features/settings/pages/clients/client.component.html index 9afedb7f5..d383d29e7 100644 --- a/src/Squidex/app/features/settings/pages/clients/client.component.html +++ b/src/Squidex/app/features/settings/pages/clients/client.component.html @@ -36,7 +36,7 @@ -
Expires: {{client.expiresUtc.toISOString()}}
+
Access token expire after one hour