mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 06:51:55 +00:00
Added authorization to controllers, added environment check to swagger, added authorization to health checks
This commit is contained in:
@@ -3,7 +3,9 @@ using Berufsschule_HAM.Models;
|
|||||||
using Berufsschule_HAM.Services;
|
using Berufsschule_HAM.Services;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using Novell.Directory.Ldap;
|
using Novell.Directory.Ldap;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class AssetsController : Controller
|
public class AssetsController : Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Novell.Directory.Ldap;
|
using Novell.Directory.Ldap;
|
||||||
using Berufsschule_HAM.Models;
|
using Berufsschule_HAM.Models;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class GroupsController : Controller
|
public class GroupsController : Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ using Berufsschule_HAM.Services;
|
|||||||
using Berufsschule_HAM.Models;
|
using Berufsschule_HAM.Models;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class LocationsController : Controller
|
public class LocationsController : Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ using Novell.Directory.Ldap;
|
|||||||
using Berufsschule_HAM.Models;
|
using Berufsschule_HAM.Models;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
[Route("[controller]")]
|
[Route("[controller]")]
|
||||||
public class UsersController : Controller
|
public class UsersController : Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -53,8 +53,11 @@ if (!app.Environment.IsDevelopment())
|
|||||||
}
|
}
|
||||||
|
|
||||||
app.UseElmah();
|
app.UseElmah();
|
||||||
app.UseSwagger();
|
if (app.Environment.IsDevelopment())
|
||||||
app.UseSwaggerUI();
|
{
|
||||||
|
app.UseSwagger();
|
||||||
|
app.UseSwaggerUI();
|
||||||
|
}
|
||||||
|
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
@@ -71,7 +74,8 @@ app.MapControllerRoute(
|
|||||||
name: "default",
|
name: "default",
|
||||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
pattern: "{controller=Home}/{action=Index}/{id?}");
|
||||||
|
|
||||||
app.MapHealthChecks("/healthz");
|
app.MapHealthChecks("/healthz")
|
||||||
|
.RequireAuthorization();
|
||||||
|
|
||||||
// Run migrations
|
// Run migrations
|
||||||
using var scope = app.Services.CreateScope();
|
using var scope = app.Services.CreateScope();
|
||||||
|
|||||||
Reference in New Issue
Block a user