Exemple #1
0
        public static void CreateConfig(string projectDirectory, AuthServerTemplate authServer, IFileSystem fileSystem)
        {
            var classPath = ClassPathHelper.AuthServerConfigClassPath(projectDirectory, "Config.cs", authServer.Name);
            var fileText  = GetConfigText(classPath.ClassNamespace, authServer);

            Utilities.CreateFile(classPath, fileText, fileSystem);
        }
Exemple #2
0
        public static string GetConfigText(string classNamespace, AuthServerTemplate authServer)
        {
            var apiResources = authServer.Apis.Aggregate("", (current, api) => current + ApiResourceTextBuilder(api));
            var apiScopes    = authServer.Scopes.Aggregate("", (current, scope) => current + ApiScopeTextBuilder(scope));
            var clients      = authServer.Clients.Aggregate("", (current, client) => current + ClientBuilder(client));

            return(@$ "{DuendeDisclosure}namespace {classNamespace};

using Duende.IdentityServer.Models;
using System.Collections.Generic;
Exemple #3
0
        public static void AddAuthServer(string solutionDirectory, IFileSystem fileSystem, AuthServerTemplate template)
        {
            SolutionBuilder.BuildAuthServerProject(solutionDirectory, template.Name, fileSystem);

            AuthServerLaunchSettingsBuilder.CreateLaunchSettings(solutionDirectory, template.Name, template.Port, fileSystem);
            StartupBuilder.CreateAuthServerStartup(solutionDirectory, template.Name, fileSystem);
            ProgramBuilder.CreateAuthServerProgram(solutionDirectory, template.Name, fileSystem);
            AuthServerConfigBuilder.CreateConfig(solutionDirectory, template, fileSystem);
            AppSettingsBuilder.CreateAuthServerAppSettings(solutionDirectory, template.Name, fileSystem);

            AuthServerPackageJsonBuilder.CreatePackageJson(solutionDirectory, template.Name, fileSystem);
            AuthServerTailwindConfigBuilder.CreateTailwindConfig(solutionDirectory, template.Name, fileSystem);
            AuthServerPostCssBuilder.CreatePostCss(solutionDirectory, template.Name, fileSystem);

            // controllers
            AuthServerAccountControllerBuilder.CreateAccountController(solutionDirectory, template.Name, fileSystem);
            AuthServerExternalControllerBuilder.CreateExternalController(solutionDirectory, template.Name, fileSystem);
            // AuthServerHomeControllerBuilder.CreateHomeController(projectDirectory, template.Name, fileSystem);

            // view models + models
            AuthServerAccountViewModelsBuilder.CreateViewModels(solutionDirectory, template.Name, fileSystem);
            AuthServerSharedViewModelsBuilder.CreateViewModels(solutionDirectory, template.Name, fileSystem);
            AuthServerExternalModelsBuilder.CreateModels(solutionDirectory, template.Name, fileSystem);
            AuthServerAccountModelsBuilder.CreateModels(solutionDirectory, template.Name, fileSystem);

            // views
            AuthServerAccountViewsBuilder.CreateLoginView(solutionDirectory, template.Name, fileSystem);
            AuthServerAccountViewsBuilder.CreateLogoutView(solutionDirectory, template.Name, fileSystem);
            AuthServerAccountViewsBuilder.CreateAccessDeniedView(solutionDirectory, template.Name, fileSystem);
            AuthServerSharedViewsBuilder.CreateLayoutView(solutionDirectory, template.Name, fileSystem);
            AuthServerSharedViewsBuilder.CreateStartView(solutionDirectory, template.Name, fileSystem);
            AuthServerSharedViewsBuilder.CreateViewImports(solutionDirectory, template.Name, fileSystem);

            // css files for TW
            AuthServerCssBuilder.CreateOutputCss(solutionDirectory, template.Name, fileSystem);
            AuthServerCssBuilder.CreateSiteCss(solutionDirectory, template.Name, fileSystem);

            // helpers
            AuthServerTestUsersBuilder.CreateTestModels(solutionDirectory, template.Name, fileSystem);
            AuthServerExtensionsBuilder.CreateExtensions(solutionDirectory, template.Name, fileSystem);
            SecurityHeadersAttributeBuilder.CreateAttribute(solutionDirectory, template.Name, fileSystem);
        }