Login settings

This commit is contained in:
Paul Schneider 2026-06-10 16:59:23 +01:00
commit 1a0556695c
37 changed files with 504 additions and 190 deletions

View file

@ -7,7 +7,7 @@ using Yavsc.Models.Blog;
using Yavsc.Server.Exceptions;
using Yavsc.Server.Helpers;
namespace Yavsc.Controllers
namespace Yavsc.Blogs.Controllers
{
[Authorize("BlogScope")]
[Produces("application/json")]

View file

@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Yavsc.Models;
using Yavsc.Models.Blog;
namespace Yavsc.Controllers
namespace Yavsc.Blogs.Controllers
{
[Produces("application/json")]
[Route("api/blogtags")]

View file

@ -8,7 +8,7 @@ using Yavsc.Models;
using Yavsc.Models.Blog;
using Yavsc.Server.Helpers;
namespace Yavsc.Controllers
namespace Yavsc.Blogs.Controllers
{
[Authorize]
[Produces("application/json")]

View file

@ -2,20 +2,15 @@
using System.Security.Claims;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Yavsc.Models;
namespace Yavsc.ApiControllers
namespace Yavsc.Blogs.Controllers
{
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Yavsc.Helpers;
using Yavsc.Models.FileSystem;
using System.ComponentModel.DataAnnotations;
using Yavsc.Attributes.Validation;
using System.IO;
using Yavsc.Models;
using Yavsc.Exceptions;
using Yavsc.Server.Helpers;
using Yavsc.Abstract.Helpers;
using Yavsc.Server.Models.FileSystem;
[Authorize,Route("api/fs")]
public partial class FileSystemApiController : Controller

View file

@ -10,7 +10,7 @@ using Yavsc.Services;
using Microsoft.AspNetCore.SignalR;
using Yavsc.Server.Helpers;
namespace Yavsc.ApiControllers
namespace Yavsc.Blogs.Controllers
{
[Authorize, Route("api/stream")]
public partial class FileSystemStreamController : Controller

View file

@ -3,7 +3,7 @@ using System.Linq;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace Yavsc.Controllers
namespace Yavsc.Blogs.Controllers
{
using System.Security.Claims;
using Microsoft.EntityFrameworkCore;

View file

@ -1,15 +0,0 @@
using Yavsc.Attributes.Validation;
namespace Yavsc.Models.FileSystem
{
public class RenameFileQuery
{
[ValidRemoteUserFilePath]
[YaStringLength(1, 512)]
public required string Id { get; set; }
[YaStringLength(0, 512)]
[ValidRemoteUserFilePath]
public required string To { get; set; }
}
}

View file

@ -15,12 +15,12 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Yavsc;
using Yavsc.Helpers;
using Yavsc.Interface;
using Yavsc.Models;
using Yavsc.Services;
using Yavsc.Server.Helpers;
using Yavsc.Extensions;
namespace Yavsc.Blogs;
internal class Program
{
@ -114,15 +114,9 @@ internal class Program
.UseAuthentication()
.UseAuthorization()
.UseCors("default")
/* .UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute()
.RequireAuthorization();
})*/
;
// app.MapIdentityApi<ApplicationUser>().RequireAuthorization("ApiScope");
app.MapDefaultControllerRoute();
app.MapIdentityApi<ApplicationUser>().RequireAuthorization("blog");
app.MapGet("/identity", (HttpContext context) =>
new JsonResult(context?.User?.Claims.Select(c => new { c.Type, c.Value }))
);

View file

@ -3,7 +3,7 @@
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>1c73094f-959f-4211-b1a1-6a69b236c283</UserSecretsId>
<RootNamespace>Yavsc.Api</RootNamespace>
<RootNamespace>Yavsc.Blogs</RootNamespace>
<RepositoryUrl>https://github.com/pazof/yavsc</RepositoryUrl>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>