diff --git a/.vscode/settings.json b/.vscode/settings.json index d5229aed..0a4785b9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -24,5 +24,7 @@ ], "cSpell.reportUnknownWords": true, "cSpell.language": "fr,en", - "makefile.configureOnOpen": false + "makefile.configureOnOpen": false, + "search.useGlobalIgnoreFiles": true, + "search.useParentIgnoreFiles": true } diff --git a/src/Yavsc.Org.Tests/NonRegression/OidcSeedTests.cs b/src/Yavsc.Org.Tests/NonRegression/OidcSeedTests.cs index 084559f2..af449ae7 100644 --- a/src/Yavsc.Org.Tests/NonRegression/OidcSeedTests.cs +++ b/src/Yavsc.Org.Tests/NonRegression/OidcSeedTests.cs @@ -37,7 +37,7 @@ namespace Yavsc { foreach (var reserved in ReservedIdentityScopeNames) { - Assert.DoesNotContain(reserved, Constants.BuildInApiScopes); + Assert.DoesNotContain(reserved, Org.Constants.BuildInApiScopes); } } @@ -46,7 +46,7 @@ namespace Yavsc { foreach (var reserved in ReservedIdentityScopeNames) { - foreach (var spec in Constants.ApiResourcesScopes) + foreach (var spec in Org.Constants.ApiResourcesScopes) { Assert.NotEqual(reserved, spec.ScopeName); } @@ -59,7 +59,7 @@ namespace Yavsc // Same ScopeName appearing twice would mean two ApiScopes // (and two ApiResourceScopes rows) trying to claim the same // name — IdentityServer8 would reject that on startup. - var scopeNames = Constants.ApiResourcesScopes + var scopeNames = Org.Constants.ApiResourcesScopes .Select(s => s.ScopeName) .ToList(); Assert.Equal(scopeNames.Count, scopeNames.Distinct().Count()); @@ -67,7 +67,7 @@ namespace Yavsc // Same ResourceName appearing twice would mean two // ApiResources rows with the same Name — the EF seed would // crash on the unique index. - var resourceNames = Constants.ApiResourcesScopes + var resourceNames = Org.Constants.ApiResourcesScopes .Select(s => s.ResourceName) .ToList(); Assert.Equal(resourceNames.Count, resourceNames.Distinct().Count()); @@ -79,7 +79,7 @@ namespace Yavsc // An empty ScopeName or ResourceName silently produces an // ApiScope / ApiResource row with no key, which breaks the // scope validator's string-based lookup later on. - foreach (var spec in Constants.ApiResourcesScopes) + foreach (var spec in Org.Constants.ApiResourcesScopes) { Assert.False(string.IsNullOrWhiteSpace(spec.ScopeName), $"ScopeName must be set (got '{spec.ScopeName}')"); @@ -95,7 +95,7 @@ namespace Yavsc { // Belt and braces: if someone ever wipes the list thinking // it's stale, this test forces them to be explicit about it. - Assert.NotEmpty(Constants.ApiResourcesScopes); + Assert.NotEmpty(Org.Constants.ApiResourcesScopes); } } -} \ No newline at end of file +} diff --git a/src/Yavsc.Org/Contants.cs b/src/Yavsc.Org/Contants.cs index 51e614c7..c8d79d6d 100644 --- a/src/Yavsc.Org/Contants.cs +++ b/src/Yavsc.Org/Contants.cs @@ -1,4 +1,5 @@ +namespace Yavsc.Org; using IdentityServer8.EntityFramework.Entities; diff --git a/src/Yavsc.Org/Extensions/HostingExtensions.cs b/src/Yavsc.Org/Extensions/HostingExtensions.cs index e4522cb6..7cca271e 100644 --- a/src/Yavsc.Org/Extensions/HostingExtensions.cs +++ b/src/Yavsc.Org/Extensions/HostingExtensions.cs @@ -534,7 +534,7 @@ public static class HostingExtensions { return (context, _) => { - foreach (String scope in Constants.BuildInApiScopes) + foreach (String scope in Org.Constants.BuildInApiScopes) { var existentScope = context.Set().FirstOrDefault(b => b.Name == scope); if (existentScope == null) @@ -575,7 +575,7 @@ public static class HostingExtensions // access to a downstream resource). Clients like PostIt that // request one of these scopes were rejected with "invalid_scope" // at the token endpoint. Keep this in ApiScopes. - foreach (var scopeSpec in Constants.ApiResourcesScopes) + foreach (var scopeSpec in Org.Constants.ApiResourcesScopes) { if (!apiScopes.Any(s => s.Name == scopeSpec.ScopeName)) { @@ -613,7 +613,7 @@ public static class HostingExtensions var apiResourceScopes = context.Set(); // Make sure every resource row referenced by the spec exists. - foreach (var resourceGroup in Constants.ApiResourcesScopes + foreach (var resourceGroup in Org.Constants.ApiResourcesScopes .GroupBy(s => s.ResourceName)) { var spec = resourceGroup.First(); @@ -646,7 +646,7 @@ public static class HostingExtensions // local list before letting EF try to translate the Where into // SQL — otherwise EF throws "The LINQ expression … could not be // translated" at runtime. - var wantedResourceNames = Constants.ApiResourcesScopes + var wantedResourceNames = Org.Constants.ApiResourcesScopes .Select(s => s.ResourceName) .ToHashSet(); @@ -654,7 +654,7 @@ public static class HostingExtensions .Where(r => wantedResourceNames.Contains(r.Name)) .ToDictionary(r => r.Name); - foreach (var scopeSpec in Constants.ApiResourcesScopes) + foreach (var scopeSpec in Org.Constants.ApiResourcesScopes) { if (!resourceByName.TryGetValue(scopeSpec.ResourceName, out var resource)) continue; @@ -665,7 +665,7 @@ public static class HostingExtensions if (alreadyLinked) continue; - apiResourceScopes.Add(new IdentityServer8.EntityFramework.Entities.ApiResourceScope + apiResourceScopes.Add(new ApiResourceScope { ApiResource = resource, ApiResourceId = resource.Id,