Browse Source

More files moved.

pull/169/head
Sebastian Stehle 9 years ago
parent
commit
78e6a0c5a1
  1. 0
      src/Squidex/Areas/IdentityServer/Config/Cert/IdentityCert.pfx
  2. 0
      src/Squidex/Areas/IdentityServer/Config/Cert/IdentityCert.snk
  3. 7
      src/Squidex/Areas/IdentityServer/Config/IdentityServerExtensions.cs
  4. 33
      src/Squidex/Areas/IdentityServer/Config/IdentityServerServices.cs
  5. 3
      src/Squidex/Areas/IdentityServer/Config/LazyClientStore.cs
  6. 2
      src/Squidex/Areas/IdentityServer/Controllers/Account/AccountController.cs
  7. 2
      src/Squidex/Areas/IdentityServer/Controllers/Account/LoginModel.cs
  8. 2
      src/Squidex/Areas/IdentityServer/Controllers/Account/LoginVM.cs
  9. 2
      src/Squidex/Areas/IdentityServer/Controllers/Error/ErrorController.cs
  10. 2
      src/Squidex/Areas/IdentityServer/Controllers/Extensions.cs
  11. 2
      src/Squidex/Areas/IdentityServer/Controllers/ExternalProvider.cs
  12. 2
      src/Squidex/Areas/IdentityServer/Controllers/Profile/ChangePasswordModel.cs
  13. 2
      src/Squidex/Areas/IdentityServer/Controllers/Profile/ChangeProfileModel.cs
  14. 2
      src/Squidex/Areas/IdentityServer/Controllers/Profile/PortalController.cs
  15. 2
      src/Squidex/Areas/IdentityServer/Controllers/Profile/ProfileController.cs
  16. 2
      src/Squidex/Areas/IdentityServer/Controllers/Profile/ProfileVM.cs
  17. 2
      src/Squidex/Areas/IdentityServer/Controllers/Profile/RemoveLoginModel.cs
  18. 2
      src/Squidex/Areas/IdentityServer/Controllers/Profile/SetPasswordModel.cs
  19. 2
      src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml
  20. 2
      src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml
  21. 0
      src/Squidex/Config/Authentication/AuthenticationExtensions.cs
  22. 0
      src/Squidex/Config/Authentication/AuthenticationServices.cs
  23. 0
      src/Squidex/Config/Authentication/GoogleAuthenticationServices.cs
  24. 0
      src/Squidex/Config/Authentication/GoogleHandler.cs
  25. 0
      src/Squidex/Config/Authentication/MicrosoftAuthenticationServices.cs
  26. 0
      src/Squidex/Config/Authentication/MicrosoftHandler.cs
  27. 44
      src/Squidex/Config/Identity/IdentityServices.cs
  28. 2
      src/Squidex/Config/MyIdentityOptions.cs
  29. 2
      src/Squidex/Squidex.csproj

0
src/Squidex/Config/Identity/Cert/IdentityCert.pfx → src/Squidex/Areas/IdentityServer/Config/Cert/IdentityCert.pfx

0
src/Squidex/Config/Identity/Cert/IdentityCert.snk → src/Squidex/Areas/IdentityServer/Config/Cert/IdentityCert.snk

7
src/Squidex/Config/Identity/IdentityExtensions.cs → src/Squidex/Areas/IdentityServer/Config/IdentityServerExtensions.cs

@ -1,5 +1,5 @@
// ==========================================================================
// IdentityExtensions.cs
// IdentityServerExtensions.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
@ -13,14 +13,15 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Squidex.Config;
using Squidex.Domain.Users;
using Squidex.Infrastructure.Log;
using Squidex.Shared.Identity;
using Squidex.Shared.Users;
namespace Squidex.Config.Identity
namespace Squidex.Areas.IdentityServer.Config
{
public static class IdentityExtensions
public static class IdentityServerExtensions
{
public static IApplicationBuilder UseMyIdentityServer(this IApplicationBuilder app)
{

33
src/Squidex/Config/Identity/IdentityServerServices.cs → src/Squidex/Areas/IdentityServer/Config/IdentityServerServices.cs

@ -13,12 +13,14 @@ using IdentityModel;
using IdentityServer4.Models;
using IdentityServer4.Stores;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Squidex.Config;
using Squidex.Domain.Users;
using Squidex.Shared.Identity;
using Squidex.Shared.Users;
namespace Squidex.Config.Identity
namespace Squidex.Areas.IdentityServer.Config
{
public static class IdentityServerServices
{
@ -26,9 +28,9 @@ namespace Squidex.Config.Identity
{
X509Certificate2 certificate;
var assembly = typeof(IdentityServices).GetTypeInfo().Assembly;
var assembly = typeof(IdentityServerServices).GetTypeInfo().Assembly;
using (var certStream = assembly.GetManifestResourceStream("Squidex.Config.Identity.Cert.IdentityCert.pfx"))
using (var certStream = assembly.GetManifestResourceStream("Squidex.Areas.IdentityServer.Config.Cert.IdentityCert.pfx"))
{
var certData = new byte[certStream.Length];
@ -39,10 +41,12 @@ namespace Squidex.Config.Identity
X509KeyStorageFlags.Exportable);
}
services.AddSingleton(
GetApiResources());
services.AddSingleton(
GetIdentityResources());
services.AddIdentity<IUser, IRole>()
.AddDefaultTokenProviders();
services.AddSingleton(GetApiResources());
services.AddSingleton(GetIdentityResources());
services.AddSingleton<IUserClaimsPrincipalFactory<IUser>,
UserClaimsPrincipalFactoryWithEmail>();
services.AddSingleton<IClientStore,
@ -60,6 +64,21 @@ namespace Squidex.Config.Identity
.AddSigningCredential(certificate);
}
public static void AddMyDataProtectection(this IServiceCollection services, IConfiguration config)
{
var dataProtection = services.AddDataProtection().SetApplicationName("Squidex");
services.AddSingleton<OrleansXmlRepository>();
services.AddSingleton<IConfigureOptions<KeyManagementOptions>>(s =>
{
return new ConfigureOptions<KeyManagementOptions>(options =>
{
options.XmlRepository = s.GetRequiredService<OrleansXmlRepository>();
});
});
}
private static IEnumerable<ApiResource> GetApiResources()
{
yield return new ApiResource(Constants.ApiScope)

3
src/Squidex/Config/Identity/LazyClientStore.cs → src/Squidex/Areas/IdentityServer/Config/LazyClientStore.cs

@ -13,11 +13,12 @@ using IdentityServer4;
using IdentityServer4.Models;
using IdentityServer4.Stores;
using Microsoft.Extensions.Options;
using Squidex.Config;
using Squidex.Domain.Apps.Core.Apps;
using Squidex.Domain.Apps.Read;
using Squidex.Infrastructure;
namespace Squidex.Config.Identity
namespace Squidex.Areas.IdentityServer.Config
{
public class LazyClientStore : IClientStore
{

2
src/Squidex/Areas/IdentityServer/Controllers/Account/AccountController.cs

@ -27,7 +27,7 @@ using Squidex.Infrastructure.Tasks;
using Squidex.Shared.Identity;
using Squidex.Shared.Users;
namespace Squidex.Controllers.UI.Account
namespace Squidex.Areas.IdentityServer.Controllers.Account
{
[SwaggerIgnore]
public sealed class AccountController : Controller

2
src/Squidex/Areas/IdentityServer/Controllers/Account/LoginModel.cs

@ -8,7 +8,7 @@
using System.ComponentModel.DataAnnotations;
namespace Squidex.Controllers.UI.Account
namespace Squidex.Areas.IdentityServer.Controllers.Account
{
public sealed class LoginModel
{

2
src/Squidex/Areas/IdentityServer/Controllers/Account/LoginVM.cs

@ -8,7 +8,7 @@
using System.Collections.Generic;
namespace Squidex.Controllers.UI.Account
namespace Squidex.Areas.IdentityServer.Controllers.Account
{
public class LoginVM
{

2
src/Squidex/Areas/IdentityServer/Controllers/Error/ErrorController.cs

@ -9,7 +9,7 @@
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
namespace Squidex.Controllers.UI.Error
namespace Squidex.Areas.IdentityServer.Controllers.Error
{
[SwaggerIgnore]
public sealed class ErrorController : Controller

2
src/Squidex/Areas/IdentityServer/Controllers/Extensions.cs

@ -12,7 +12,7 @@ using Microsoft.AspNetCore.Identity;
using Squidex.Domain.Users;
using Squidex.Shared.Users;
namespace Squidex.Controllers.UI
namespace Squidex.Areas.IdentityServer.Controllers
{
public static class Extensions
{

2
src/Squidex/Areas/IdentityServer/Controllers/ExternalProvider.cs

@ -6,7 +6,7 @@
// All rights reserved.
// ==========================================================================
namespace Squidex.Controllers.UI
namespace Squidex.Areas.IdentityServer.Controllers
{
public class ExternalProvider
{

2
src/Squidex/Areas/IdentityServer/Controllers/Profile/ChangePasswordModel.cs

@ -8,7 +8,7 @@
using System.ComponentModel.DataAnnotations;
namespace Squidex.Controllers.UI.Profile
namespace Squidex.Areas.IdentityServer.Controllers.Profile
{
public class ChangePasswordModel
{

2
src/Squidex/Areas/IdentityServer/Controllers/Profile/ChangeProfileModel.cs

@ -8,7 +8,7 @@
using System.ComponentModel.DataAnnotations;
namespace Squidex.Controllers.UI.Profile
namespace Squidex.Areas.IdentityServer.Controllers.Profile
{
public class ChangeProfileModel
{

2
src/Squidex/Areas/IdentityServer/Controllers/Profile/PortalController.cs

@ -13,7 +13,7 @@ using NSwag.Annotations;
using Squidex.Domain.Apps.Read.Apps.Services;
using Squidex.Infrastructure.Security;
namespace Squidex.Controllers.UI.Profile
namespace Squidex.Areas.IdentityServer.Controllers.Profile
{
[Authorize]
[SwaggerIgnore]

2
src/Squidex/Areas/IdentityServer/Controllers/Profile/ProfileController.cs

@ -24,7 +24,7 @@ using Squidex.Infrastructure.Assets;
using Squidex.Infrastructure.Reflection;
using Squidex.Shared.Users;
namespace Squidex.Controllers.UI.Profile
namespace Squidex.Areas.IdentityServer.Controllers.Profile
{
[Authorize]
[SwaggerIgnore]

2
src/Squidex/Areas/IdentityServer/Controllers/Profile/ProfileVM.cs

@ -9,7 +9,7 @@
using System.Collections.Generic;
using Squidex.Shared.Users;
namespace Squidex.Controllers.UI.Profile
namespace Squidex.Areas.IdentityServer.Controllers.Profile
{
public sealed class ProfileVM
{

2
src/Squidex/Areas/IdentityServer/Controllers/Profile/RemoveLoginModel.cs

@ -8,7 +8,7 @@
using System.ComponentModel.DataAnnotations;
namespace Squidex.Controllers.UI.Profile
namespace Squidex.Areas.IdentityServer.Controllers.Profile
{
public class RemoveLoginModel
{

2
src/Squidex/Areas/IdentityServer/Controllers/Profile/SetPasswordModel.cs

@ -8,7 +8,7 @@
using System.ComponentModel.DataAnnotations;
namespace Squidex.Controllers.UI.Profile
namespace Squidex.Areas.IdentityServer.Controllers.Profile
{
public class SetPasswordModel
{

2
src/Squidex/Areas/IdentityServer/Views/Account/Login.cshtml

@ -1,4 +1,4 @@
@model Squidex.Controllers.UI.Account.LoginVM
@model Squidex.Areas.IdentityServer.Controllers.Account.LoginVM
@{
var type = Model.IsLogin ? "Login" : "Signup";

2
src/Squidex/Areas/IdentityServer/Views/Profile/Profile.cshtml

@ -1,4 +1,4 @@
@model Squidex.Controllers.UI.Profile.ProfileVM
@model Squidex.Areas.IdentityServer.Controllers.Profile.ProfileVM
@{
ViewBag.Theme = "white";

0
src/Squidex/Config/Identity/AuthenticationExtensions.cs → src/Squidex/Config/Authentication/AuthenticationExtensions.cs

0
src/Squidex/Config/Identity/AuthenticationServices.cs → src/Squidex/Config/Authentication/AuthenticationServices.cs

0
src/Squidex/Config/Identity/GoogleAuthenticationServices.cs → src/Squidex/Config/Authentication/GoogleAuthenticationServices.cs

0
src/Squidex/Config/Identity/GoogleHandler.cs → src/Squidex/Config/Authentication/GoogleHandler.cs

0
src/Squidex/Config/Identity/MicrosoftAuthenticationServices.cs → src/Squidex/Config/Authentication/MicrosoftAuthenticationServices.cs

0
src/Squidex/Config/Identity/MicrosoftHandler.cs → src/Squidex/Config/Authentication/MicrosoftHandler.cs

44
src/Squidex/Config/Identity/IdentityServices.cs

@ -1,44 +0,0 @@
// ==========================================================================
// IdentityServices.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.DataProtection.KeyManagement;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Squidex.Domain.Users;
using Squidex.Domain.Users.DataProtection.Orleans;
using Squidex.Shared.Users;
namespace Squidex.Config.Identity
{
public static class IdentityServices
{
public static void AddMyIdentity(this IServiceCollection services)
{
services.AddIdentity<IUser, IRole>()
.AddDefaultTokenProviders();
}
public static void AddMyDataProtectection(this IServiceCollection services, IConfiguration config)
{
var dataProtection = services.AddDataProtection().SetApplicationName("Squidex");
services.AddSingleton<OrleansXmlRepository>();
services.AddSingleton<IConfigureOptions<KeyManagementOptions>>(s =>
{
return new ConfigureOptions<KeyManagementOptions>(options =>
{
options.XmlRepository = s.GetRequiredService<OrleansXmlRepository>();
});
});
}
}
}

2
src/Squidex/Config/Identity/MyIdentityOptions.cs → src/Squidex/Config/MyIdentityOptions.cs

@ -6,7 +6,7 @@
// All rights reserved.
// ==========================================================================
namespace Squidex.Config.Identity
namespace Squidex.Config
{
public sealed class MyIdentityOptions
{

2
src/Squidex/Squidex.csproj

@ -12,7 +12,7 @@
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="Config\Identity\Cert\*.*;Docs\*.md" />
<EmbeddedResource Include="Areas\IdentityServer\Config\Cert\*.*;Docs\*.md" />
<EmbeddedResource Include="Controllers\Api\Users\Assets\Avatar.png" />
<EmbeddedResource Remove="Assets\**" />

Loading…
Cancel
Save