Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Added UseRequireLoginMiddleware extension method #98

Open
wants to merge 56 commits into
base: 3.0
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
db33493
Initial migration to 3.0
DamianEdwards May 12, 2019
306885b
Update sln file to Dev16
DamianEdwards May 15, 2019
1df8034
Application clean up
davidfowl May 16, 2019
4c1899f
Use username for attendees
davidfowl May 16, 2019
7715b4f
Change filter to middleware
davidfowl May 16, 2019
c6b568b
Simplify admin user creation (first is admin)
DamianEdwards May 17, 2019
0729467
Cache conference data on home page.
DamianEdwards May 18, 2019
7994588
ExcludeAssets="runtime" for scaffolding package to prevent Roslyn, et…
DamianEdwards May 24, 2019
0d3d67f
Move session abstract line formatting to the razor file
DamianEdwards May 24, 2019
e2ac852
Use System.Text.Json on the backend
davidfowl Jun 1, 2019
ec71919
Moved to preview6
DamianEdwards Jun 11, 2019
e40f69a
Removed feeds
davidfowl Jun 14, 2019
fd50c14
3.0 updates to session 1 and session 2
davidfowl Jun 15, 2019
0435987
Finished up to 3
davidfowl Jun 15, 2019
c32d109
Updated images and project creation
davidfowl Jun 15, 2019
44ec856
More updates
davidfowl Jun 15, 2019
0878679
More changes to descriptions
davidfowl Jun 16, 2019
6618815
Streamline project creation from the command line
davidfowl Jun 16, 2019
8417709
Fixe dotnet ef global tool instructions
davidfowl Jun 16, 2019
26d1195
Add conosle coloring
davidfowl Jun 16, 2019
d31a763
Half updated section 4
davidfowl Jun 16, 2019
23c106c
Updated auth features
davidfowl Jun 16, 2019
5c2c238
Make the MyAgenda page work again
DamianEdwards Jun 16, 2019
af6b9c0
Updated session5
davidfowl Jun 16, 2019
ad8f1a8
Use the endpoint routes
davidfowl Jun 16, 2019
8c8c910
Small tweaks
davidfowl Jun 16, 2019
368c3f2
Fixed image
davidfowl Jun 16, 2019
ee63094
Got app working
DamianEdwards Jun 16, 2019
cf1de7f
Make EditSession use AlertPartial
DamianEdwards Jun 16, 2019
1665f20
Fix the Session page so unauthenticated users can view it
DamianEdwards Jun 16, 2019
dad1df3
Fix scaffolding package reference
DamianEdwards Jun 16, 2019
bcc4f25
Updated docs
davidfowl Jun 16, 2019
0545b67
Add NDC Oslo data
davidfowl Jun 17, 2019
452075d
Made some tweaks to session2
davidfowl Jun 17, 2019
a8f16f2
Use the extension methods to get search results
davidfowl Jun 17, 2019
a21c224
Small nits
davidfowl Jun 17, 2019
e28fdce
Add EF error and work around
davidfowl Jun 17, 2019
36cd17e
Small nits in global tool
davidfowl Jun 17, 2019
c807479
Use preview6 image
davidfowl Jun 17, 2019
339b020
Added the first snapshot
davidfowl Jun 17, 2019
60c19a7
Added more save points
davidfowl Jun 17, 2019
51c8e7e
Added more save points
davidfowl Jun 17, 2019
e04d885
More save points
davidfowl Jun 17, 2019
d5d4c7f
Updated save points
davidfowl Jun 17, 2019
e5af7ce
Remove install package image
davidfowl Jun 17, 2019
77f086f
Clean up the first session instructions
davidfowl Jun 17, 2019
6a41dee
Changes to snapshot and session2
davidfowl Jun 17, 2019
76bcc6a
Remove redundant EntityExtensions
davidfowl Jun 17, 2019
85c75cb
Session 4 clean up
davidfowl Jun 17, 2019
5bc9526
Minor tweaks to 6
davidfowl Jun 17, 2019
a570f67
Put swagger first
davidfowl Jun 18, 2019
18bf2e3
Before routing is more appropriate
davidfowl Jun 18, 2019
7622c41
Fixed the tag name
davidfowl Jun 18, 2019
4a3ff6c
Tweaks to the workshop docs
davidfowl Jun 18, 2019
d46a50d
Fixed db -> _context
davidfowl Jun 18, 2019
73559ac
Added UseRequireLoginMiddleware extension method
mmayr-at Jun 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added the first snapshot
davidfowl committed Jun 17, 2019
commit 339b020daed43a33d516d7c8b3b9bf4144a8a97c
2 changes: 1 addition & 1 deletion docs/1. Create BackEnd API project.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

## Creating a new project using the Command Line

1. Create folder ConferencePlanner and call `dotnet new sln` at the cmd line to create a solution
1. Create folder `ConferencePlanner` and call `dotnet new sln` at the cmd line to create a solution
1. Create a project using `dotnet new webapi -n BackEnd` at the cmd line inside the folder BackEnd
1. Add the project to the solution using `dotnet sln add BackEnd`

Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview6.19304.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0-preview6.19304.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0-preview6.19304.10">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0-preview5-19264-04">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc2" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using BackEnd.Models;
@@ -45,7 +43,7 @@ public async Task<ActionResult<Speaker>> GetSpeaker(int id)
[HttpPut("{id}")]
public async Task<IActionResult> PutSpeaker(int id, Speaker speaker)
{
if (id != speaker.ID)
if (id != speaker.Id)
{
return BadRequest();
}
@@ -78,7 +76,7 @@ public async Task<ActionResult<Speaker>> PostSpeaker(Speaker speaker)
_context.Speakers.Add(speaker);
await _context.SaveChangesAsync();

return CreatedAtAction("GetSpeaker", new { id = speaker.ID }, speaker);
return CreatedAtAction("GetSpeaker", new { id = speaker.Id }, speaker);
}

// DELETE: api/Speakers/5
@@ -99,7 +97,7 @@ public async Task<ActionResult<Speaker>> DeleteSpeaker(int id)

private bool SpeakerExists(int id)
{
return _context.Speakers.Any(e => e.ID == id);
return _context.Speakers.Any(e => e.Id == id);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -11,15 +11,15 @@ protected override void Up(MigrationBuilder migrationBuilder)
name: "Speakers",
columns: table => new
{
ID = table.Column<int>(nullable: false)
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(maxLength: 200, nullable: false),
Bio = table.Column<string>(maxLength: 4000, nullable: true),
WebSite = table.Column<string>(maxLength: 1000, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Speakers", x => x.ID);
table.PrimaryKey("PK_Speakers", x => x.Id);
});
}

Original file line number Diff line number Diff line change
@@ -14,13 +14,13 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.1-servicing-10028")
.HasAnnotation("ProductVersion", "3.0.0-preview6.19304.10")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

modelBuilder.Entity("BackEnd.Models.Speaker", b =>
{
b.Property<int>("ID")
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

@@ -34,7 +34,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("WebSite")
.HasMaxLength(1000);

b.HasKey("ID");
b.HasKey("Id");

b.ToTable("Speakers");
});
Original file line number Diff line number Diff line change
@@ -3,14 +3,12 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.EntityFrameworkCore.Design;

namespace BackEnd.Models
{
public class Speaker
{
public int ID { get; set; }
public int Id { get; set; }

[Required]
[StringLength(200)]
@@ -22,4 +20,4 @@ public class Speaker
[StringLength(1000)]
public virtual string WebSite { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace BackEnd
@@ -14,11 +13,14 @@ public class Program
{
public static void Main(string[] args)
{
CreateWebHostBuilder(args).Build().Run();
CreateHostBuilder(args).Build().Run();
}

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
@@ -11,9 +11,9 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.Swagger;
using Microsoft.OpenApi.Models;

namespace BackEnd
{
@@ -41,34 +41,36 @@ public void ConfigureServices(IServiceCollection services)
}
});

services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
services.AddControllers();

services.AddSwaggerGen(options =>
options.SwaggerDoc("v1", new Info { Title = "Conference Planner API", Version = "v1" })
);
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Conference Planner API", Version = "v1" }));
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}

app.UseHttpsRedirection();

app.UseRouting();

app.UseAuthorization();

app.UseSwagger();

app.UseSwaggerUI(options =>
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Conference Planner API v1")
);

if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
app.UseEndpoints(endpoints =>
{
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}

app.UseHttpsRedirection();
app.UseMvc();
endpoints.MapControllers();
});

app.Run(context =>
{
Original file line number Diff line number Diff line change
@@ -2,10 +2,12 @@
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=aspnet-BackEnd-931E56BD-86CB-4A96-BD99-2C6A6ABB0829;Trusted_Connection=True;MultipleActiveResultSets=true"
},
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*"
"Logging": {
"LogLevel": {
"Default": "Warning",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.329
# Visual Studio Version 16
VisualStudioVersion = 16.0.29007.179
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackEnd", "BackEnd\BackEnd.csproj", "{E7864CB1-70EF-4BDE-95D7-6078DE7F1F13}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BackEnd", "BackEnd\BackEnd.csproj", "{54B73C40-8060-4718-A682-5A1C32C1E83A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E7864CB1-70EF-4BDE-95D7-6078DE7F1F13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7864CB1-70EF-4BDE-95D7-6078DE7F1F13}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7864CB1-70EF-4BDE-95D7-6078DE7F1F13}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7864CB1-70EF-4BDE-95D7-6078DE7F1F13}.Release|Any CPU.Build.0 = Release|Any CPU
{54B73C40-8060-4718-A682-5A1C32C1E83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54B73C40-8060-4718-A682-5A1C32C1E83A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54B73C40-8060-4718-A682-5A1C32C1E83A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54B73C40-8060-4718-A682-5A1C32C1E83A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {716BD0AE-1BA1-4372-B4C1-BFE9CFA5FA18}
SolutionGuid = {7C5D815A-7FB9-4BB2-962E-F66EC67114A4}
EndGlobalSection
EndGlobal