mirror of https://github.com/Squidex/squidex.git
32 changed files with 206 additions and 198 deletions
@ -0,0 +1,25 @@ |
|||
// ==========================================================================
|
|||
// Extensions.cs
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex Group
|
|||
// All rights reserved.
|
|||
// ==========================================================================
|
|||
|
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.Filters; |
|||
|
|||
namespace Squidex.Areas.IdentityServer.Controllers |
|||
{ |
|||
[Area("IdentityServer")] |
|||
public abstract class IdentityServerController : Controller |
|||
{ |
|||
public override void OnActionExecuting(ActionExecutingContext context) |
|||
{ |
|||
if (!context.HttpContext.Request.PathBase.StartsWithSegments("/identity-server")) |
|||
{ |
|||
context.Result = new RedirectResult("/"); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
// ==========================================================================
|
|||
// Startup.cs
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex Group
|
|||
// All rights reserved.
|
|||
// ==========================================================================
|
|||
|
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Squidex.Areas.IdentityServer.Config; |
|||
using Squidex.Config; |
|||
|
|||
namespace Squidex.Areas.IdentityServer |
|||
{ |
|||
public static class Startup |
|||
{ |
|||
public static void ConfigureIdentityServer(this IApplicationBuilder app) |
|||
{ |
|||
app.ApplicationServices.UseMyAdminRole(); |
|||
app.ApplicationServices.UseMyAdmin(); |
|||
|
|||
var environment = app.ApplicationServices.GetRequiredService<IHostingEnvironment>(); |
|||
|
|||
app.Map(Constants.IdentityPrefix, identityApp => |
|||
{ |
|||
app.UseMyIdentityServer(); |
|||
|
|||
if (environment.IsDevelopment()) |
|||
{ |
|||
identityApp.UseDeveloperExceptionPage(); |
|||
} |
|||
else |
|||
{ |
|||
identityApp.UseExceptionHandler("/error"); |
|||
} |
|||
|
|||
identityApp.UseStaticFiles(); |
|||
identityApp.UseMvc(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -1,22 +0,0 @@ |
|||
// ==========================================================================
|
|||
// AuthenticationExtensions.cs
|
|||
// Squidex Headless CMS
|
|||
// ==========================================================================
|
|||
// Copyright (c) Squidex Group
|
|||
// All rights reserved.
|
|||
// ==========================================================================
|
|||
|
|||
using Microsoft.AspNetCore.Builder; |
|||
|
|||
namespace Squidex.Config.Identity |
|||
{ |
|||
public static class AuthenticationExtensions |
|||
{ |
|||
public static IApplicationBuilder UseMyAuthentication(this IApplicationBuilder app) |
|||
{ |
|||
app.UseAuthentication(); |
|||
|
|||
return app; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue