diff --git a/src/Core/Identity/ApiResources.cs b/src/Api/IdentityServer/ApiResources.cs similarity index 94% rename from src/Core/Identity/ApiResources.cs rename to src/Api/IdentityServer/ApiResources.cs index bd8d412b14..56f4afc736 100644 --- a/src/Core/Identity/ApiResources.cs +++ b/src/Api/IdentityServer/ApiResources.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Security.Claims; -namespace Bit.Core.Identity +namespace Bit.Api.IdentityServer { public class ApiResources { diff --git a/src/Core/Identity/Clients.cs b/src/Api/IdentityServer/Clients.cs similarity index 95% rename from src/Core/Identity/Clients.cs rename to src/Api/IdentityServer/Clients.cs index 8669d4f49d..34020104a2 100644 --- a/src/Core/Identity/Clients.cs +++ b/src/Api/IdentityServer/Clients.cs @@ -1,7 +1,7 @@ using IdentityServer4.Models; using System.Collections.Generic; -namespace Bit.Core.Identity +namespace Bit.Api.IdentityServer { public class Clients { diff --git a/src/Core/Identity/PersistedGrantStore.cs b/src/Api/IdentityServer/PersistedGrantStore.cs similarity index 98% rename from src/Core/Identity/PersistedGrantStore.cs rename to src/Api/IdentityServer/PersistedGrantStore.cs index 3d65e480f2..2ce3e1ec7b 100644 --- a/src/Core/Identity/PersistedGrantStore.cs +++ b/src/Api/IdentityServer/PersistedGrantStore.cs @@ -7,7 +7,7 @@ using Bit.Core.Repositories; using IdentityServer4.Models; using IdentityServer4.Stores; -namespace Bit.Core.Identity +namespace Bit.Api.IdentityServer { public class PersistedGrantStore : IPersistedGrantStore { diff --git a/src/Core/Identity/ProfileService.cs b/src/Api/IdentityServer/ProfileService.cs similarity index 96% rename from src/Core/Identity/ProfileService.cs rename to src/Api/IdentityServer/ProfileService.cs index b3e2626f89..6f1f1c8393 100644 --- a/src/Core/Identity/ProfileService.cs +++ b/src/Api/IdentityServer/ProfileService.cs @@ -4,7 +4,7 @@ using IdentityServer4.Models; using Bit.Core.Repositories; using Bit.Core.Services; -namespace Bit.Core.Identity +namespace Bit.Api.IdentityServer { public class ProfileService : IProfileService { diff --git a/src/Core/Identity/ResourceOwnerPasswordValidator.cs b/src/Api/IdentityServer/ResourceOwnerPasswordValidator.cs similarity index 95% rename from src/Core/Identity/ResourceOwnerPasswordValidator.cs rename to src/Api/IdentityServer/ResourceOwnerPasswordValidator.cs index 808c8648c0..4402dfd24c 100644 --- a/src/Core/Identity/ResourceOwnerPasswordValidator.cs +++ b/src/Api/IdentityServer/ResourceOwnerPasswordValidator.cs @@ -1,5 +1,6 @@ using Bit.Core.Domains; using Bit.Core.Enums; +using Bit.Core.Exceptions; using Bit.Core.Repositories; using IdentityServer4.Models; using IdentityServer4.Validation; @@ -10,7 +11,7 @@ using System; using System.Security.Claims; using System.Threading.Tasks; -namespace Bit.Core.Identity +namespace Bit.Api.IdentityServer { public class ResourceOwnerPasswordValidator : IResourceOwnerPasswordValidator { @@ -66,7 +67,8 @@ namespace Bit.Core.Identity } context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, - twoFactorRequest ? "Code is not correct. Try again." : "Username or password is incorrect. Try again."); + twoFactorRequest ? "Code is not correct. Try again." : "Username or password is incorrect. Try again.", + new System.Collections.Generic.Dictionary { { "Error", true } }); } private async Task TwoFactorRequiredAsync(User user) diff --git a/src/Core/Identity/TokenRetrieval.cs b/src/Api/IdentityServer/TokenRetrieval.cs similarity index 96% rename from src/Core/Identity/TokenRetrieval.cs rename to src/Api/IdentityServer/TokenRetrieval.cs index da55cb7fe6..84cfb7a6b0 100644 --- a/src/Core/Identity/TokenRetrieval.cs +++ b/src/Api/IdentityServer/TokenRetrieval.cs @@ -2,7 +2,7 @@ using System; using System.Linq; -namespace Bit.Core.Identity +namespace Bit.Api.IdentityServer { public static class TokenRetrieval { diff --git a/src/Api/Startup.cs b/src/Api/Startup.cs index 602da8cd39..430c3b83b2 100644 --- a/src/Api/Startup.cs +++ b/src/Api/Startup.cs @@ -29,6 +29,7 @@ using IdentityServer4.Stores; using Bit.Core.Utilities; using Serilog; using Serilog.Events; +using Bit.Api.IdentityServer; namespace Bit.Api { diff --git a/src/Api/project.json b/src/Api/project.json index aaf839cc0a..4b0816ba6c 100644 --- a/src/Api/project.json +++ b/src/Api/project.json @@ -22,7 +22,9 @@ "Microsoft.ApplicationInsights.AspNetCore": "1.0.2", "AspNetCoreRateLimit": "1.0.5", "Serilog.Extensions.Logging": "1.3.1", - "Serilog.Sinks.AzureDocumentDb": "3.5.17" + "Serilog.Sinks.AzureDocumentDb": "3.5.17", + "IdentityServer4": "1.0.1", + "IdentityServer4.AccessTokenValidation": "1.0.2" }, "tools": { diff --git a/src/Core/project.json b/src/Core/project.json index a2d761a7d6..03388c68e6 100644 --- a/src/Core/project.json +++ b/src/Core/project.json @@ -8,8 +8,6 @@ "Sendgrid": "6.3.4", "PushSharp": "4.0.10", "WindowsAzure.Storage": "8.0.0", - "IdentityServer4": "1.0.1", - "IdentityServer4.AccessTokenValidation": "1.0.2", "Otp.NET": "1.0.0" },