Commit 377a0829 authored by Eric Dieckman's avatar Eric Dieckman
Browse files

remove extraneous packages

parent 722bf99a
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -24,19 +24,9 @@
  </PropertyGroup>

  <PropertyGroup>
    <SpaRoot>ClientApp\</SpaRoot>
    <DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
    <UserSecretsId>42d92035-8955-4b56-a987-e91c9f1f5f56</UserSecretsId>
  </PropertyGroup>

  <ItemGroup>
    <!-- Don't publish the SPA source files, but do show them in the project files list -->
    <Compile Remove="Profiles\**" />
    <Content Remove="$(SpaRoot)**" />
    <Content Remove="Profiles\**" />
    <None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Remove="Profiles\**" />
    <None Remove="Profiles\**" />
@@ -46,17 +36,11 @@
    <PackageReference Include="Cals.Authentication.Identity" Version="1.0.0" />
    <PackageReference Include="Cals.Caching" Version="2.0.3" />
    <PackageReference Include="Cals.Cqrs" Version="2.1.0" />
    <PackageReference Include="Aae.Extensions.Api" Version="1.3.3" />
    <PackageReference Include="Azure.Extensions.AspNetCore.Configuration.Secrets" Version="1.4.0" />
    <PackageReference Include="Hellang.Middleware.ProblemDetails" Version="6.5.1" />
    <PackageReference Include="MailKit" Version="4.14.1" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.21" />
    <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.21" />
    <PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="8.0.21" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.11">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.Azure" Version="1.13.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.7" />
    <PackageReference Include="Quartz.Extensions.Hosting" Version="3.14.0" />
@@ -69,7 +53,6 @@
  </ItemGroup>

  <ItemGroup>
    <Folder Include="ClientApp\src\directives\" />
    <Folder Include="SeedWork\" />
  </ItemGroup>

+293 −0
Original line number Diff line number Diff line
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>Cals.Visor.Api</name>
    </assembly>
    <members>
        <member name="T:Cals.Visor.Api.Authorization.AppGroups">
            <summary>
            Config object holding values for app groups from appsettings.
            </summary>
        </member>
        <member name="M:Cals.Visor.Api.Authorization.AuthorizationExtensions.AddPermissionsAuthorization(Microsoft.Extensions.DependencyInjection.IServiceCollection)">
            <summary>
            Adds authorization services to the specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
            </summary>
            <param name="services">The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add services to.</param>
            <returns>The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection"/> so that additional calls can be chained.</returns>
        </member>
        <member name="M:Cals.Visor.Api.Authorization.AuthorizationExtensions.AddAuthorization(Microsoft.Extensions.DependencyInjection.IServiceCollection,Cals.Visor.Api.Authorization.AppGroups)">
            <summary>
            Adds authorization services to the specified <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />. Also initializes the app groups.
            </summary>
            <param name="services">The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" /> to add services to.</param>
            <param name="appGroups"></param>
            <returns>The <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection"/> so that additional calls can be chained.</returns>
        </member>
        <member name="T:Cals.Visor.Api.Authorization.AccessAppHandler">
            <summary>
            Handler for <see cref="T:Cals.Visor.Api.Authorization.AccessAppPermission"/>.
            </summary>
        </member>
        <member name="F:Cals.Visor.Api.Authorization.Policies.RequireAtLeastOneAppGroup">
            <summary>
            Allows access when client has at least one of the groups.
            </summary>
        </member>
        <member name="T:Cals.Visor.Api.Authorization.AccessAppPermission">
            <summary>
            Permission to simply access the app (minimum permission.
            </summary>
        </member>
        <member name="M:Cals.Visor.Api.Controllers.AuthController.GetGroups">
            <summary>
            Returns a listing of all system groups, and all groups that the logged-in user is a member of.
            </summary>
        </member>
        <member name="M:Cals.Visor.Api.Identity.ApplicationBuildingExtensions.UseAppIdentity(Microsoft.AspNetCore.Builder.IApplicationBuilder)">
            <summary>
            Enables use of the Visor user identity.
            </summary>
            <param name="app"></param>
            <returns></returns>
        </member>
        <member name="M:Cals.Visor.Api.Identity.ApplicationBuildingExtensions.UseAppIdentity(Microsoft.AspNetCore.Builder.IApplicationBuilder,Cals.Visor.Api.Identity.IdentityUserOptions)">
            <summary>
            Enables Visor user with the given options.
            </summary>
        </member>
        <member name="T:Cals.Visor.Api.Identity.IdentityMiddleware">
            <summary>
            Middleware to add this app user's identity to the ClaimsPrincipal.
            </summary>
        </member>
        <member name="M:Cals.Visor.Api.Identity.IdentityMiddleware.#ctor(Microsoft.AspNetCore.Http.RequestDelegate,Microsoft.Extensions.Options.IOptions{Cals.Visor.Api.Identity.IdentityUserOptions},Microsoft.Extensions.Logging.ILoggerFactory)">
            <summary>
            Initializes a new instance of the <see cref="T:Cals.Visor.Api.Identity.IdentityMiddleware"/> class.
            </summary>
            <param name="next">The next middleware in the pipeline.</param>
            <param name="options">The configuration options.</param>
            <param name="loggerFactory">An <see cref="T:Microsoft.Extensions.Logging.ILoggerFactory"/> instance used to create loggers.</param>
        </member>
        <member name="M:Cals.Visor.Api.Identity.IdentityMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext,Cals.Cqrs.IRequestProcessor)">
            <summary>
            Processes a request to add the Visor identity to the user principal.
            </summary>
            <param name="context"></param>
            <param name="requestProcessor"></param>
            <returns></returns>
        </member>
        <member name="T:Cals.Visor.Api.Identity.IdentityUserOptions">
            <summary>
            Options for Identity Middleware.
            </summary>
        </member>
        <member name="T:Cals.Visor.Identity.VisorUser">
            <summary>
            <see cref="T:Cals.Authentication.IApplicationUser"/> for the Directory Edit app.
            </summary>
        </member>
        <member name="T:Cals.Web.ErrorHandling.EndpointExtractor">
            <summary>
            Extracts endpoint information from the HttpContext.
            </summary>
        </member>
        <member name="T:Cals.Web.ErrorHandling.ErrorEmailCreator">
            <summary>
            Generates an email from the provided exception model.
            </summary>
        </member>
        <member name="M:Cals.Web.ErrorHandling.ErrorEmailCreator.CreateEmailHeader(System.String,System.String,System.Uri,System.String)">
            <summary>
            Creates the header section in the email.
            </summary>
            <param name="ip">Remote IP of the user.</param>
            <param name="user">Username of the user.</param>
            <param name="uri">Uri that generated the error.</param>
            <param name="errorType">Description text of what the error is.</param>
            <returns></returns>
        </member>
        <member name="M:Cals.Web.ErrorHandling.ErrorEmailCreator.CreateQuerySection(Microsoft.AspNetCore.Http.IQueryCollection)">
            <summary>
            Creates the Querystring section from the request querystring.
            </summary>
            <returns>A 2 element array holding the strings generated
            0 = plain text
            1 = html.
            </returns>
        </member>
        <member name="M:Cals.Web.ErrorHandling.ErrorEmailCreator.CreateHeadersSection(System.Collections.Generic.IDictionary{System.String,Microsoft.Extensions.Primitives.StringValues})">
            <summary>
            Creates the headers section from the request headers.
            </summary>
            <returns>A 2 element array holding the strings generated
            0 = plain text
            1 = html.
            </returns>
        </member>
        <member name="M:Cals.Web.ErrorHandling.ErrorEmailCreator.CreateRoutingSection(Cals.Web.ErrorHandling.EndpointModel,Microsoft.AspNetCore.Routing.RouteValueDictionary)">
            <summary>
            Creates the routing section from the request endpoint information and routing values dictionary.
            </summary>
            <returns>A 2 element array holding the strings generated
            0 = plain text
            1 = html.
            </returns>
        </member>
        <member name="T:Cals.Web.ErrorHandling.ErrorEmailModel">
            <summary>
            Holds data to be displayed in the error model.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ErrorEmailModel.ErrorDetails">
            <summary>
            Detailed information about each exception in the stack.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ErrorEmailModel.Query">
            <summary>
            Parsed query data.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ErrorEmailModel.Cookies">
            <summary>
            Request cookies.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ErrorEmailModel.Headers">
            <summary>
            Request headers.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ErrorEmailModel.RouteValues">
            <summary>
            Request route values.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ErrorEmailModel.Endpoint">
            <summary>
            Request endpoint.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ErrorEmailModel.IpAddress">
            <summary>
            Requesting IP address.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ErrorEmailModel.UserId">
            <summary>
            User ID of logged user.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ErrorEmailModel.Uri">
            <summary>
            Original requesting URL.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ErrorEmailModel.StatusCode">
            <summary>
            Status code for the error.
            </summary>
        </member>
        <member name="T:Cals.Web.ErrorHandling.ExceptionDetails">
            <summary>
            Contains details for individual exception messages.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ExceptionDetails.Error">
            <summary>
            An individual exception.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ExceptionDetails.StackFrames">
            <summary>
            The generated stack frames.
            </summary>
        </member>
        <member name="P:Cals.Web.ErrorHandling.ExceptionDetails.ErrorMessage">
            <summary>
            Gets or sets the summary message.
            </summary>
        </member>
        <member name="T:Cals.Helpers.StackTrace.StackFrameSourceCodeInfo">
            <summary>
            Contains the source code where the exception occurred.
            </summary>
        </member>
        <member name="P:Cals.Helpers.StackTrace.StackFrameSourceCodeInfo.Function">
            <summary>
            Function containing instruction.
            </summary>
        </member>
        <member name="P:Cals.Helpers.StackTrace.StackFrameSourceCodeInfo.File">
            <summary>
            File containing the instruction.
            </summary>
        </member>
        <member name="P:Cals.Helpers.StackTrace.StackFrameSourceCodeInfo.Line">
            <summary>
            The line number of the instruction.
            </summary>
        </member>
        <member name="P:Cals.Helpers.StackTrace.StackFrameSourceCodeInfo.PreContextLine">
            <summary>
            The line preceding the frame line.
            </summary>
        </member>
        <member name="P:Cals.Helpers.StackTrace.StackFrameSourceCodeInfo.PreContextCode">
            <summary>
            Lines of code before the actual error line(s).
            </summary>
        </member>
        <member name="P:Cals.Helpers.StackTrace.StackFrameSourceCodeInfo.ContextCode">
            <summary>
            Line(s) of code responsible for the error.
            </summary>
        </member>
        <member name="P:Cals.Helpers.StackTrace.StackFrameSourceCodeInfo.PostContextCode">
            <summary>
            Lines of code after the actual error line(s).
            </summary>
        </member>
        <member name="P:Cals.Helpers.StackTrace.StackFrameSourceCodeInfo.ErrorDetails">
            <summary>
            Specific error details for this stack frame.
            </summary>
        </member>
        <member name="M:Cals.Helpers.TypeNameHelper.GetTypeDisplayName(System.Type,System.Boolean,System.Boolean,System.Boolean,System.Char)">
            <summary>
            Pretty print a type name.
            </summary>
            <param name="type">The <see cref="T:System.Type"/>.</param>
            <param name="fullName"><c>true</c> to print a fully qualified name.</param>
            <param name="includeGenericParameterNames"><c>true</c> to include generic parameter names.</param>
            <param name="includeGenericParameters"><c>true</c> to include generic parameters.</param>
            <param name="nestedTypeDelimiter">Character to use as a delimiter in nested type names.</param>
            <returns>The pretty printed type name.</returns>
        </member>
        <member name="T:Cals.Api.Validation.ValidateModelAttribute">
            <summary>
            Validates a model state and returns a BadRequest for invalid models.
            </summary>
            <remarks>https://www.jerriepelser.com/blog/validation-response-aspnet-core-webapi/.</remarks>
        </member>
        <member name="T:Cals.Api.Validation.ValidationError">
            <summary>
            Response returned when a validation error occurs.
            </summary>
            <remarks>https://www.jerriepelser.com/blog/validation-response-aspnet-core-webapi/.</remarks>
        </member>
        <member name="T:Cals.Api.Validation.ValidationFailedResult">
            <summary>
            Action result that is returned for failed validation.
            </summary>
            <remarks>https://www.jerriepelser.com/blog/validation-response-aspnet-core-webapi/.</remarks>
        </member>
        <member name="T:Cals.Api.Validation.ValidationResultModel">
            <summary>
            Model of the result of validation of a model.
            </summary>
            <remarks>https://www.jerriepelser.com/blog/validation-response-aspnet-core-webapi/.</remarks>
        </member>
    </members>
</doc>
+0 −1
Original line number Diff line number Diff line
using Cals.Visor.Infrastructure.Contexts;
using Cals.Visor.Models;
using Cals.Visor.Api.ViewModels;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;

+38 −82
Original line number Diff line number Diff line
using System.Security.Claims;
using System.Security.Cryptography.X509Certificates;
using Azure.Core;
using Azure.Identity;
using Cals.Caching;
using Cals.Cqrs;
using Cals.Visor.Application;
using Cals.Visor.Application.Identity;
using Cals.Visor.Infrastructure;
using Cals.Visor.Api;
using Cals.Visor.Api.Authorization;
using Cals.Visor.Api.Helpers;
using Cals.Visor.Api.Helpers.Vue;
using Cals.Visor.Api.Identity;
using Cals.Visor.Api.SeedWork;
using Cals.Web.ErrorHandling;
using Cals.Visor.Application;
using Cals.Visor.Application.Identity;
using Cals.Visor.Infrastructure;
using Hellang.Middleware.ProblemDetails;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;


//using Cals.Identity;
using Quartz;
using UW.AspNetCore.Authentication;

#pragma warning disable SA1005
#pragma warning disable SA1512 // Single-line comments should not be followed by blank line
@@ -30,34 +19,32 @@ var builder = WebApplication.CreateBuilder(args);

ConfigureAzureKeyVault(builder);

builder.Services
    .AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddJwtBearer(options =>
    {
        options.Authority = "https://login.wisc.edu";
        options.Audience = "cals_wra";
        options.TokenValidationParameters = new TokenValidationParameters
        {
            ValidateAudience = true,
            ValidateIssuer = true
        };

        options.Events = new JwtBearerEvents
        {
            OnTokenValidated = context =>
            {
                ClaimsIdentity identity = (ClaimsIdentity)context.Principal!.Identity!;
                var token = context.SecurityToken.RawData;
                identity.AddClaim(new Claim("access_token", token));
                return Task.CompletedTask;
            }
        }
    });



var appConfig = AppConfigGenerator.Create(builder.Configuration, builder.Environment);
ConfigureViews(builder.Services, appConfig);
//builder.Services
//    .AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
//    .AddJwtBearer(options =>
//    {
//        options.Authority = "https://login.wisc.edu";
//        options.Audience = "cals_wra";
//        options.TokenValidationParameters = new TokenValidationParameters
//        {
//            ValidateAudience = true,
//            ValidateIssuer = true
//        };

//        options.Events = new JwtBearerEvents
//        {
//            OnTokenValidated = context =>
//            {
//                ClaimsIdentity identity = (ClaimsIdentity)context.Principal!.Identity!;
//                var token = context.SecurityToken.RawData;
//                identity.AddClaim(new Claim("access_token", token));
//                return Task.CompletedTask;
//            }
//        }
//    });


builder.Services.AddControllers();

builder.Services.AddInMemoryCaching();

@@ -66,10 +53,13 @@ builder.Services.AddHttpContextAccessor();
builder.Services.AddApplication();
builder.Services.AddTransient<ICurrentUser, CurrentUserSource>();   //  how can we add this into .AddApplication()?
builder.Services.AddInfrastructure(builder.Configuration);   // BE SURE TO RE-REGISTER DomainEventsDispatcherNotificationHandlerDecorator
builder.Services.AddTransient<IVueParser, VueParser>();
//builder.Services.AddApiDocumentation();

builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();

//// ############# AUTHORIZATION ################
builder.Services.AddAuthorization(appConfig.Groups);
//builder.Services.AddAuthorization(appConfig.Groups);

builder.Services.AddProblemDetails(x =>
{
@@ -90,18 +80,6 @@ builder.Host.UseDefaultServiceProvider(o =>

WebApplication app = builder.Build();

if (!app.Environment.IsDevelopment())
{
    app.UseHsts();
    app.UseExceptionHandler("/error");
    app.UseStatusCodePagesWithReExecute("/error/{0}");
    app.UseExceptionEmailer();
}
else
{
    //app.UseStatusCodePages();
}

app.UseStaticFiles();

// AFTER UseStaticFiles, UseExceptionHandler or UseStatusCodePagesWithReExecute but BEFORE UseAuthentication and UseAuthorization
@@ -109,23 +87,15 @@ app.UseRouting();

app.UseAuthentication();
app.UseHttpsRedirection();
app.UseResponseCompression();

app.UseAppIdentity();

app.UseAuthorization();
app.UseSwagger();
app.UseSwaggerUI();

// must UseEndpoints otherwise the UseSpa extension does not work properly
// https://github.com/dotnet/aspnetcore/blob/8968058c9e5fdfdd1242426a03dc80609997edab/src/Middleware/Spa/SpaServices.Extensions/src/SpaDefaultPageMiddleware.cs#L25
#pragma warning disable ASP0014 // Suggest using top level route registrations
app.UseEndpoints(endpoints =>
{
    endpoints.MapControllers()
        .RequireAuthorization(Policies.RequireAtLeastOneAppGroup);
    endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
});
#pragma warning restore ASP0014 // Suggest using top level route registrations
app.UseAuthorization();

app.MapControllers();

//// register service locator - used in CommandsExecutor
ServiceActivator.Configure(app.Services);
@@ -168,20 +138,6 @@ void ConfigureAzureKeyVault(WebApplicationBuilder builder)
    }
}

// Add controllers and views with the app config filter.  Sets defaults for routing options
void ConfigureViews(IServiceCollection services, AppConfig appConfig)
{
    services.AddControllersWithViews(options =>
    {
        options.Filters.Add(new AppConfigActionFilter(appConfig));
    });

    services.Configure<RouteOptions>(options => options.LowercaseUrls = true);
    services.Configure<RouteOptions>(options => options.AppendTrailingSlash = true);

    services.AddResponseCompression(options => options.EnableForHttps = true);
}

// Add the background service platform Quartz for internal commands and outbox
void ConfigureQuartz(IServiceCollection services)
{