Skip to content

Commit

Permalink
harmonize QS UI code and namespaces for all host projects
Browse files Browse the repository at this point in the history
  • Loading branch information
brockallen committed Jun 12, 2020
1 parent 63217ae commit e581c13
Show file tree
Hide file tree
Showing 120 changed files with 233 additions and 182 deletions.
2 changes: 1 addition & 1 deletion src/AspNetIdentity/host/Configuration/Clients.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using IdentityServer4.Models;
using System.Collections.Generic;

namespace Host.Configuration
namespace IdentityServerHost.Configuration
{
public static class Clients
{
Expand Down
2 changes: 1 addition & 1 deletion src/AspNetIdentity/host/Configuration/ClientsConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using IdentityServer4;
using IdentityServer4.Models;

namespace Host.Configuration
namespace IdentityServerHost.Configuration
{
public static class ClientsConsole
{
Expand Down
2 changes: 1 addition & 1 deletion src/AspNetIdentity/host/Configuration/ClientsWeb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using IdentityServer4;
using IdentityServer4.Models;

namespace Host.Configuration
namespace IdentityServerHost.Configuration
{
public static class ClientsWeb
{
Expand Down
2 changes: 1 addition & 1 deletion src/AspNetIdentity/host/Configuration/Resources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Collections.Generic;
using static IdentityServer4.IdentityServerConstants;

namespace Host.Configuration
namespace IdentityServerHost.Configuration
{
public class Resources
{
Expand Down
2 changes: 1 addition & 1 deletion src/AspNetIdentity/host/Data/ApplicationDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;

namespace Host.Data
namespace IdentityServerHost.Data
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
Expand Down
71 changes: 48 additions & 23 deletions src/AspNetIdentity/host/Program.cs
Original file line number Diff line number Diff line change
@@ -1,40 +1,65 @@
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved.
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


using Microsoft.AspNetCore.Hosting;
using System;
using Microsoft.Extensions.Hosting;
using Serilog;
using Serilog.Sinks.SystemConsole.Themes;
using Microsoft.AspNetCore;
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
using System;
using System.Diagnostics;

namespace Host
namespace IdentityServerHost
{
public class Program
{
public static void Main(string[] args)
public static int Main(string[] args)
{
Console.Title = "IdentityServer4.AspNetIdentity";
Activity.DefaultIdFormat = ActivityIdFormat.W3C;

Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.Hosting.Lifetime", LogEventLevel.Information)
.MinimumLevel.Override("System", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
.Enrich.FromLogContext()
//.WriteTo.File(@"identityserver4_log.txt")
// uncomment to write to Azure diagnostics stream
//.WriteTo.File(
// @"D:\home\LogFiles\Application\identityserver.txt",
// fileSizeLimitBytes: 1_000_000,
// rollOnFileSizeLimit: true,
// shared: true,
// flushToDiskInterval: TimeSpan.FromSeconds(1))
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Code)
.CreateLogger();

CreateWebHostBuilder(args).Build().Run();
try
{
Log.Information("Starting host...");
CreateHostBuilder(args).Build().Run();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly.");
return 1;
}
finally
{
Log.CloseAndFlush();
}
}

public static IWebHostBuilder CreateWebHostBuilder(string[] args)
{
return WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseSerilog((context, config) =>
{
config
.MinimumLevel.Debug()
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
.MinimumLevel.Override("System", LogEventLevel.Warning)
.MinimumLevel.Override("Microsoft.AspNetCore.Authentication", LogEventLevel.Information)
.Enrich.FromLogContext()
.WriteTo.File(@"identityserver4_log.txt")
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level}] {SourceContext}{NewLine}{Message:lj}{NewLine}{Exception}{NewLine}", theme: AnsiConsoleTheme.Literate);
});
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseSerilog()
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@


using IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Extensions;
using IdentityServer4.Models;
Expand All @@ -17,7 +18,7 @@
using System.Linq;
using System.Threading.Tasks;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
[SecurityHeaders]
[AllowAnonymous]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using System;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class AccountOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
using System.Threading.Tasks;
using IdentityModel;
using IdentityServer4;
using IdentityServer4.Events;
using IdentityServer4.Models;
using IdentityServer4.Quickstart.UI;
using IdentityServer4.Services;
using IdentityServer4.Stores;
using IdentityServer4.Test;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
[SecurityHeaders]
[AllowAnonymous]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class ExternalProvider
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class LoggedOutViewModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using System.ComponentModel.DataAnnotations;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class LoginInputModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Collections.Generic;
using System.Linq;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class LoginViewModel : LoginInputModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class LogoutInputModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class LogoutViewModel : LogoutInputModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@



namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class RedirectViewModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using System.Collections.Generic;
using System;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
/// <summary>
/// This controller processes the consent UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using System.Collections.Generic;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class ConsentInputModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class ConsentOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using System.Collections.Generic;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class ConsentViewModel : ConsentInputModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using IdentityServer4.Models;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class ProcessConsentResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class ScopeViewModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class DeviceAuthorizationInputModel : ConsentInputModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.


namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class DeviceAuthorizationViewModel : ConsentViewModel
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
[Authorize]
[SecurityHeaders]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
[SecurityHeaders]
[Authorize]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Collections.Generic;
using System.Text;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class DiagnosticsViewModel
{
Expand Down
2 changes: 1 addition & 1 deletion src/AspNetIdentity/host/Quickstart/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using IdentityServer4.Models;
using Microsoft.AspNetCore.Mvc;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public static class Extensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using IdentityServer4.Events;
using IdentityServer4.Extensions;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
/// <summary>
/// This sample controller allows a user to revoke grants given to clients
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System;
using System.Collections.Generic;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class GrantsViewModel
{
Expand Down
2 changes: 1 addition & 1 deletion src/AspNetIdentity/host/Quickstart/Home/ErrorViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using IdentityServer4.Models;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
public class ErrorViewModel
{
Expand Down
2 changes: 1 addition & 1 deletion src/AspNetIdentity/host/Quickstart/Home/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;

namespace IdentityServer4.Quickstart.UI
namespace IdentityServerHost.Quickstart.UI
{
[SecurityHeaders]
[AllowAnonymous]
Expand Down
Loading

0 comments on commit e581c13

Please sign in to comment.