Refactoring
The main server owns the migrations, it's the server part, it's simpler. It's Yavsc, not one of its lib.
This commit is contained in:
@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Blog;
|
using Yavsc.Models.Blog;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Blog;
|
using Yavsc.Models.Blog;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ namespace Yavsc.Controllers
|
|||||||
using Models;
|
using Models;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models.Blog;
|
using Yavsc.Models.Blog;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Route("~/api/PostTagsApi")]
|
[Route("~/api/PostTagsApi")]
|
||||||
|
@ -8,6 +8,7 @@ namespace Yavsc.Controllers
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Models.Relationship;
|
using Models.Relationship;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Route("api/TagsApi")]
|
[Route("api/TagsApi")]
|
||||||
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Authorization;
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Yavsc.Api.Helpers;
|
using Yavsc.Server.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Workflow;
|
using Yavsc.Models.Workflow;
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ namespace Yavsc.Controllers
|
|||||||
using Yavsc.Abstract.Identity;
|
using Yavsc.Abstract.Identity;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
[Produces("application/json")]
|
[Produces("application/json")]
|
||||||
[Route("api/bookquery"), Authorize(Roles = "Performer,Administrator")]
|
[Route("api/bookquery"), Authorize(Roles = "Performer,Administrator")]
|
||||||
|
@ -10,6 +10,7 @@ using Newtonsoft.Json;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Billing;
|
using Yavsc.Models.Billing;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Billing;
|
using Yavsc.Models.Billing;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Market;
|
using Yavsc.Models.Market;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Messaging;
|
using Yavsc.Models.Messaging;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Haircut;
|
using Yavsc.Models.Haircut;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,7 @@ namespace Yavsc.ApiControllers
|
|||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
[Route("api/haircut")][Authorize]
|
[Route("api/haircut")][Authorize]
|
||||||
public class HairCutController : Controller
|
public class HairCutController : Controller
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Musical;
|
using Yavsc.Models.Musical;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Musical;
|
using Yavsc.Models.Musical;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Identity;
|
using Yavsc.Models.Identity;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
[Authorize, Route("~/api/gcm")]
|
[Authorize, Route("~/api/gcm")]
|
||||||
public class NativeConfidentialController : Controller
|
public class NativeConfidentialController : Controller
|
||||||
|
@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Access;
|
using Yavsc.Models.Access;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Access;
|
using Yavsc.Models.Access;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Chat;
|
using Yavsc.Models.Chat;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Relationship;
|
using Yavsc.Models.Relationship;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Abstract.Identity;
|
using Yavsc.Abstract.Identity;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Market;
|
using Yavsc.Models.Market;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Abstract.Identity;
|
using Yavsc.Abstract.Identity;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Abstract.Identity;
|
using Yavsc.Abstract.Identity;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.ApiControllers.accounting
|
namespace Yavsc.ApiControllers.accounting
|
||||||
{
|
{
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
using System.Security.Claims;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Yavsc.Models;
|
|
||||||
using Yavsc.Models.Blog;
|
|
||||||
|
|
||||||
namespace Yavsc.Api.Helpers
|
|
||||||
{
|
|
||||||
public static class UserHelpers
|
|
||||||
{
|
|
||||||
public static string? GetUserId(this ClaimsPrincipal user)
|
|
||||||
{
|
|
||||||
return user.FindFirstValue("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,11 +1,6 @@
|
|||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Yavsc.Models;
|
|
||||||
using Yavsc.Models.Blog;
|
|
||||||
|
|
||||||
namespace Yavsc.Helpers
|
namespace Yavsc.Server.Helpers
|
||||||
{
|
{
|
||||||
public static class UserHelpers
|
public static class UserHelpers
|
||||||
{
|
{
|
||||||
@ -24,30 +19,5 @@ namespace Yavsc.Helpers
|
|||||||
return user.Identity.IsAuthenticated;
|
return user.Identity.IsAuthenticated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<BlogPost> UserPosts(this ApplicationDbContext dbContext, string posterId, string? readerId)
|
|
||||||
{
|
|
||||||
if (readerId == null)
|
|
||||||
{
|
|
||||||
var userPosts = dbContext.blogSpotPublications.Include(
|
|
||||||
b => b.BlogPost
|
|
||||||
).Where(x => x.BlogPost.AuthorId == posterId)
|
|
||||||
.Select(x=>x.BlogPost).ToArray();
|
|
||||||
return userPosts;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
long[] readerCirclesMemberships =
|
|
||||||
dbContext.Circle.Include(c => c.Members)
|
|
||||||
.Where(c => c.Members.Any(m => m.MemberId == readerId))
|
|
||||||
.Select(c => c.Id).ToArray();
|
|
||||||
return dbContext.BlogSpot.Include(
|
|
||||||
b => b.Author
|
|
||||||
).Include(p => p.ACL).Where(x => x.Author.Id == posterId &&
|
|
||||||
(x.ACL.Count == 0 || x.ACL.Any(a => readerCirclesMemberships.Contains(a.CircleId))));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@ namespace Yavsc
|
|||||||
using Models.Chat;
|
using Models.Chat;
|
||||||
using Yavsc.Abstract.Chat;
|
using Yavsc.Abstract.Chat;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
using Yavsc.Services;
|
using Yavsc.Services;
|
||||||
public partial class ChatHub : Hub, IDisposable
|
public partial class ChatHub : Hub, IDisposable
|
||||||
{
|
{
|
||||||
|
@ -1,26 +1,2 @@
|
|||||||
SOURCE_DIR=../..
|
listConnections:
|
||||||
MAKEFILE_DIR=$(SOURCE_DIR)/scripts/make
|
dotnet ef migrations list --connection "$(YAVSC_CONNECTION_STRING)"
|
||||||
BASERESX=Resources/Yavsc.Models.Relationship.HyperLink.resx \
|
|
||||||
Resources/Yavsc.Models.Streaming.LiveFlow.resx
|
|
||||||
BASERESXGEN=$(BASERESX:.resx=.Designer.cs)
|
|
||||||
|
|
||||||
include $(MAKEFILE_DIR)/dnx.mk
|
|
||||||
include $(MAKEFILE_DIR)/versioning.mk
|
|
||||||
|
|
||||||
default: all
|
|
||||||
|
|
||||||
$(BINTARGETPATH): ../OAuth.AspNet.AuthServer/bin/$(CONFIGURATION)/OAuth.AspNet.AuthServer.dll \
|
|
||||||
../Yavsc.Abstract/bin/$(CONFIGURATION)/Yavsc.Abstract.dll prepare_code
|
|
||||||
|
|
||||||
../OAuth.AspNet.AuthServer/bin/$(CONFIGURATION)/OAuth.AspNet.AuthServer.dll:
|
|
||||||
make -C ../OAuth.AspNet.AuthServer
|
|
||||||
|
|
||||||
../Yavsc.Abstract/bin/$(CONFIGURATION)/Yavsc.Abstract.dll:
|
|
||||||
make -C ../Yavsc.Abstract
|
|
||||||
|
|
||||||
%.Designer.cs: %.resx
|
|
||||||
strongresbuildercli -l -p -t -r "Yavsc.Server.Resources." $^
|
|
||||||
|
|
||||||
prepare_code: $(BASERESXGEN)
|
|
||||||
|
|
||||||
all: $(BINTARGETPATH)
|
|
||||||
|
@ -36,6 +36,10 @@ namespace Yavsc.Models
|
|||||||
|
|
||||||
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
||||||
{
|
{
|
||||||
|
public ApplicationDbContext()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
|
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using Microsoft.Extensions.Options;
|
|||||||
using rules;
|
using rules;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Services
|
namespace Yavsc.Services
|
||||||
{
|
{
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
|
|
||||||
using IdentityServer8.Models;
|
|
||||||
using IdentityServer8.Stores;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Yavsc.Models;
|
|
||||||
|
|
||||||
namespace Yavsc.Services;
|
|
||||||
|
|
||||||
public class YavscClientStore : IClientStore
|
|
||||||
{
|
|
||||||
ApplicationDbContext _context=null;
|
|
||||||
public YavscClientStore(ApplicationDbContext context)
|
|
||||||
{
|
|
||||||
_context = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async Task<Client> IClientStore.FindClientByIdAsync(string clientId)
|
|
||||||
{
|
|
||||||
var app = await _context.Applications.FirstOrDefaultAsync(c=>c.Id == clientId);
|
|
||||||
|
|
||||||
if (app == null) return null;
|
|
||||||
|
|
||||||
Client client = new()
|
|
||||||
{
|
|
||||||
ClientId = app.Id,
|
|
||||||
ClientName = app.DisplayName,
|
|
||||||
AbsoluteRefreshTokenLifetime = app.RefreshTokenLifeTime,
|
|
||||||
AccessTokenLifetime = app.AccessTokenLifetime,
|
|
||||||
AllowedGrantTypes =
|
|
||||||
[
|
|
||||||
GrantType.AuthorizationCode,
|
|
||||||
GrantType.DeviceFlow,
|
|
||||||
GrantType.ClientCredentials
|
|
||||||
],
|
|
||||||
ClientSecrets = [
|
|
||||||
new Secret(app.Secret),
|
|
||||||
]
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
switch(app.Type)
|
|
||||||
{
|
|
||||||
case Models.Auth.ApplicationTypes.NativeConfidential:
|
|
||||||
client.AccessTokenType = AccessTokenType.Reference;
|
|
||||||
client.AllowedGrantTypes =
|
|
||||||
[
|
|
||||||
GrantType.DeviceFlow
|
|
||||||
];
|
|
||||||
client.AllowedScopes = [] ;
|
|
||||||
break;
|
|
||||||
case Models.Auth.ApplicationTypes.JavaScript:
|
|
||||||
default:
|
|
||||||
client.AccessTokenType = AccessTokenType.Jwt;
|
|
||||||
client.AllowedGrantTypes =
|
|
||||||
[
|
|
||||||
GrantType.AuthorizationCode,
|
|
||||||
GrantType.ClientCredentials
|
|
||||||
];
|
|
||||||
client.AllowedScopes = ["openid", "profile"];
|
|
||||||
break;
|
|
||||||
|
|
||||||
}
|
|
||||||
return client;
|
|
||||||
}
|
|
||||||
}
|
|
@ -27,6 +27,7 @@ using IdentityModel;
|
|||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text.Unicode;
|
using System.Text.Unicode;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,7 @@ using Yavsc.Services;
|
|||||||
using Yavsc.ViewModels.Manage;
|
using Yavsc.ViewModels.Manage;
|
||||||
using Microsoft.AspNetCore.Identity.UI.Services;
|
using Microsoft.AspNetCore.Identity.UI.Services;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
@ -709,7 +710,8 @@ namespace Yavsc.Controllers
|
|||||||
|
|
||||||
private async Task<ApplicationUser> GetCurrentUserAsync()
|
private async Task<ApplicationUser> GetCurrentUserAsync()
|
||||||
{
|
{
|
||||||
return await _dbContext.Users.Include(u => u.PostalAddress).FirstOrDefaultAsync(u => u.Id == User.GetUserId());
|
return await _dbContext.Users.Include(u => u.PostalAddress)
|
||||||
|
.FirstOrDefaultAsync(u => u.Id == User.GetUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Abstract.Identity;
|
using Yavsc.Abstract.Identity;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
using Yavsc.ViewModels;
|
using Yavsc.ViewModels;
|
||||||
using Yavsc.ViewModels.Administration;
|
using Yavsc.ViewModels.Administration;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ using Yavsc.Server.Settings;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Server.Models.Calendar;
|
using Yavsc.Server.Models.Calendar;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ using Microsoft.Extensions.Options;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Yavsc.ViewModels.Blog;
|
using Yavsc.ViewModels.Blog;
|
||||||
using Yavsc.Server.Exceptions;
|
using Yavsc.Server.Exceptions;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
|
// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Relationship;
|
using Yavsc.Models.Relationship;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Relationship;
|
using Yavsc.Models.Relationship;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Blog;
|
using Yavsc.Models.Blog;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@ using Yavsc.Abstract.Models.Messaging;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Messaging;
|
using Yavsc.Models.Messaging;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,7 @@ namespace Yavsc.Controllers
|
|||||||
using Models;
|
using Models;
|
||||||
using Models.Workflow;
|
using Models.Workflow;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
[Authorize("AdministratorOnly")]
|
[Authorize("AdministratorOnly")]
|
||||||
public class ActivityController : Controller
|
public class ActivityController : Controller
|
||||||
|
@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Auth;
|
using Yavsc.Models.Auth;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Workflow;
|
using Yavsc.Models.Workflow;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,7 @@ namespace Yavsc.Controllers
|
|||||||
using Models.Workflow;
|
using Models.Workflow;
|
||||||
using Services;
|
using Services;
|
||||||
using Yavsc.Interface;
|
using Yavsc.Interface;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
using Yavsc.Settings;
|
using Yavsc.Settings;
|
||||||
|
|
||||||
public class CommandController : Controller
|
public class CommandController : Controller
|
||||||
|
@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Workflow;
|
using Yavsc.Models.Workflow;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,7 @@ namespace Yavsc.Controllers
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class DoController : Controller
|
public class DoController : Controller
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Forms;
|
using Yavsc.Models.Forms;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ namespace Yavsc.Controllers
|
|||||||
using Models;
|
using Models;
|
||||||
using Models.Musical;
|
using Models.Musical;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
public class MusicalTendenciesController : Controller
|
public class MusicalTendenciesController : Controller
|
||||||
{
|
{
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Billing;
|
using Yavsc.Models.Billing;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ namespace Yavsc.Controllers.Generic
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Models;
|
using Models;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
using Yavsc.Services;
|
using Yavsc.Services;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
|
@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Drawing;
|
using Yavsc.Models.Drawing;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -26,6 +26,7 @@ namespace Yavsc.Controllers
|
|||||||
using Yavsc.Interface;
|
using Yavsc.Interface;
|
||||||
using Yavsc.Settings;
|
using Yavsc.Settings;
|
||||||
using Yavsc.Abstract.Models.Messaging;
|
using Yavsc.Abstract.Models.Messaging;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
public class HairCutCommandController : CommandController
|
public class HairCutCommandController : CommandController
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Haircut;
|
using Yavsc.Models.Haircut;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc.Localization;
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Diagnostics;
|
using Microsoft.AspNetCore.Diagnostics;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -5,6 +5,7 @@ using Yavsc.Models;
|
|||||||
using Yavsc.Server.Models.IT.SourceCode;
|
using Yavsc.Server.Models.IT.SourceCode;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Musical.Profiles;
|
using Yavsc.Models.Musical.Profiles;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@ namespace Yavsc.Controllers
|
|||||||
using Models;
|
using Models;
|
||||||
using Models.Musical;
|
using Models.Musical;
|
||||||
using Yavsc.Helpers;
|
using Yavsc.Helpers;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
|
|
||||||
public class InstrumentsController : Controller
|
public class InstrumentsController : Controller
|
||||||
{
|
{
|
||||||
|
@ -6,6 +6,7 @@ using Yavsc.Helpers;
|
|||||||
using Yavsc.Migrations;
|
using Yavsc.Migrations;
|
||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Blog;
|
using Yavsc.Models.Blog;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
using Yavsc.ViewModels.Auth;
|
using Yavsc.ViewModels.Auth;
|
||||||
|
|
||||||
namespace Yavsc.Extensions;
|
namespace Yavsc.Extensions;
|
||||||
|
@ -1,10 +1,32 @@
|
|||||||
using System.Security.Claims;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Yavsc.Models;
|
||||||
|
using Yavsc.Models.Blog;
|
||||||
|
|
||||||
namespace Yavsc.Helpers
|
namespace Yavsc.Helpers
|
||||||
{
|
{
|
||||||
public static class UserHelpers
|
public static class UserHelpers
|
||||||
{
|
{
|
||||||
|
public static IEnumerable<BlogPost> UserPosts(this ApplicationDbContext dbContext, string posterId, string? readerId)
|
||||||
|
{
|
||||||
|
if (readerId == null)
|
||||||
|
{
|
||||||
|
var userPosts = dbContext.blogSpotPublications.Include(
|
||||||
|
b => b.BlogPost
|
||||||
|
).Where(x => x.BlogPost.AuthorId == posterId)
|
||||||
|
.Select(x => x.BlogPost).ToArray();
|
||||||
|
return userPosts;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
long[] readerCirclesMemberships =
|
||||||
|
dbContext.Circle.Include(c => c.Members)
|
||||||
|
.Where(c => c.Members.Any(m => m.MemberId == readerId))
|
||||||
|
.Select(c => c.Id).ToArray();
|
||||||
|
return dbContext.BlogSpot.Include(
|
||||||
|
b => b.Author
|
||||||
|
).Include(p => p.ACL).Where(x => x.Author.Id == posterId &&
|
||||||
|
(x.ACL.Count == 0 || x.ACL.Any(a => readerCirclesMemberships.Contains(a.CircleId))));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using Yavsc.Helpers;
|
|||||||
using Yavsc.Models;
|
using Yavsc.Models;
|
||||||
using Yavsc.Models.Blog;
|
using Yavsc.Models.Blog;
|
||||||
using Yavsc.Server.Exceptions;
|
using Yavsc.Server.Exceptions;
|
||||||
|
using Yavsc.Server.Helpers;
|
||||||
using Yavsc.ViewModels.Auth;
|
using Yavsc.ViewModels.Auth;
|
||||||
using Yavsc.ViewModels.Blog;
|
using Yavsc.ViewModels.Blog;
|
||||||
|
|
@ -49,10 +49,8 @@ namespace Yavsc.Services
|
|||||||
public static ConcurrentDictionary<string, ChatRoomInfo> Channels = new ConcurrentDictionary<string, ChatRoomInfo>();
|
public static ConcurrentDictionary<string, ChatRoomInfo> Channels = new ConcurrentDictionary<string, ChatRoomInfo>();
|
||||||
readonly ApplicationDbContext _dbContext;
|
readonly ApplicationDbContext _dbContext;
|
||||||
readonly IStringLocalizer _localizer;
|
readonly IStringLocalizer _localizer;
|
||||||
|
|
||||||
public HubConnectionManager(IServiceScopeFactory ssf )
|
public HubConnectionManager(IServiceScopeFactory ssf )
|
||||||
{
|
{
|
||||||
|
|
||||||
var scope = ssf.CreateScope();
|
var scope = ssf.CreateScope();
|
||||||
_dbContext = scope.ServiceProvider.GetService<ApplicationDbContext>();
|
_dbContext = scope.ServiceProvider.GetService<ApplicationDbContext>();
|
||||||
var loggerFactory = scope.ServiceProvider.GetService<ILoggerFactory>();
|
var loggerFactory = scope.ServiceProvider.GetService<ILoggerFactory>();
|
@ -23,8 +23,15 @@ public class ClientStore : IClientStore
|
|||||||
ClientId = clientFromDb.Id,
|
ClientId = clientFromDb.Id,
|
||||||
ClientName = clientFromDb.DisplayName,
|
ClientName = clientFromDb.DisplayName,
|
||||||
ClientSecrets = { new Secret(clientFromDb.Secret.Sha256()) },
|
ClientSecrets = { new Secret(clientFromDb.Secret.Sha256()) },
|
||||||
AllowedGrantTypes =[ GrantType.ClientCredentials, GrantType.DeviceFlow],
|
AllowedGrantTypes =
|
||||||
AllowedScopes = ["openid", "profile", "scope1"]
|
[
|
||||||
|
GrantType.AuthorizationCode,
|
||||||
|
GrantType.DeviceFlow,
|
||||||
|
GrantType.ClientCredentials
|
||||||
|
],
|
||||||
|
AllowedScopes = ["openid", "profile", "scope1"],
|
||||||
|
AbsoluteRefreshTokenLifetime = clientFromDb.RefreshTokenLifeTime,
|
||||||
|
AccessTokenLifetime = clientFromDb.AccessTokenLifetime
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
@using Microsoft.AspNetCore.Html;
|
@using Microsoft.AspNetCore.Html;
|
||||||
@using Microsoft.AspNetCore.Identity;
|
@using Microsoft.AspNetCore.Identity;
|
||||||
@using Yavsc.Helpers;
|
@using Yavsc.Helpers;
|
||||||
|
@using Yavsc.Server.Helpers;
|
||||||
@using PayPal.PayPalAPIInterfaceService.Model;
|
@using PayPal.PayPalAPIInterfaceService.Model;
|
||||||
|
|
||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
@ -30,10 +30,13 @@ namespace yavscTests
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var serverUrl = _serverFixture.Addresses.FirstOrDefault();
|
||||||
|
|
||||||
String auth = _serverFixture.SiteSettings.Authority;
|
String auth = _serverFixture.SiteSettings.Authority;
|
||||||
|
|
||||||
var oauthor = new OAuthenticator(clientId, clientSecret, scope,
|
var oauthor = new OAuthenticator(_serverFixture.TestClientId, _serverFixture.TestClientSecret,
|
||||||
new Uri(authorizeUrl), new Uri(redirectUrl), new Uri(accessTokenUrl));
|
"profile",
|
||||||
|
new Uri(serverUrl), new Uri(serverUrl), new Uri(serverUrl+"/connect/token"));
|
||||||
var query = new Dictionary<string, string>
|
var query = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
["Username"] = userName,
|
["Username"] = userName,
|
||||||
|
@ -17,6 +17,7 @@ using yavscTests.Settings;
|
|||||||
using Yavsc.Extensions;
|
using Yavsc.Extensions;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
|
using Microsoft.AspNetCore.Mvc.ModelBinding.Binders;
|
||||||
|
using Yavsc.Models.Auth;
|
||||||
|
|
||||||
namespace isnd.tests
|
namespace isnd.tests
|
||||||
{
|
{
|
||||||
@ -32,6 +33,7 @@ namespace isnd.tests
|
|||||||
public IConfigurationRoot Configuration { get; private set; }
|
public IConfigurationRoot Configuration { get; private set; }
|
||||||
|
|
||||||
private WebApplication app;
|
private WebApplication app;
|
||||||
|
public string TestClientId { get; private set; }
|
||||||
|
|
||||||
public IServiceProvider Services { get; private set; }
|
public IServiceProvider Services { get; private set; }
|
||||||
public string TestingUserName { get; private set; }
|
public string TestingUserName { get; private set; }
|
||||||
@ -41,6 +43,7 @@ namespace isnd.tests
|
|||||||
public SiteSettings SiteSettings { get => siteSettings; set => siteSettings = value; }
|
public SiteSettings SiteSettings { get => siteSettings; set => siteSettings = value; }
|
||||||
public MailSender MailSender { get; internal set; }
|
public MailSender MailSender { get; internal set; }
|
||||||
public TestingSetup? TestingSetup { get; internal set; }
|
public TestingSetup? TestingSetup { get; internal set; }
|
||||||
|
public string TestClientSecret { get; private set; } = "TestClientSecret";
|
||||||
|
|
||||||
public WebServerFixture()
|
public WebServerFixture()
|
||||||
{
|
{
|
||||||
@ -63,7 +66,7 @@ namespace isnd.tests
|
|||||||
.AddEnvironmentVariables()
|
.AddEnvironmentVariables()
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
this.app = builder.ConfigureWebAppServices();
|
this.app = builder.ConfigureWebAppServices();
|
||||||
Services = app.Services;
|
Services = app.Services;
|
||||||
using (var migrationScope = app.Services.CreateScope())
|
using (var migrationScope = app.Services.CreateScope())
|
||||||
{
|
{
|
||||||
@ -96,12 +99,26 @@ namespace isnd.tests
|
|||||||
dbContext.Database.Migrate();
|
dbContext.Database.Migrate();
|
||||||
|
|
||||||
TestingUserName = "Tester";
|
TestingUserName = "Tester";
|
||||||
TestingUser = dbContext.Users.FirstOrDefault(u => u.UserName == TestingUserName);
|
TestClientId = "testClientId";
|
||||||
|
TestingUser = await dbContext.Users.FirstOrDefaultAsync(u => u.UserName == TestingUserName);
|
||||||
EnsureUser(TestingUserName);
|
EnsureUser(TestingUserName);
|
||||||
|
// ensure a client
|
||||||
ServicePointManager.ServerCertificateValidationCallback =
|
var testClient = await dbContext.Client.FirstOrDefaultAsync((c) => c.Id == TestClientId);
|
||||||
(sender, cert, chain, sslPolicyErrors) => true;
|
if (testClient == null)
|
||||||
|
{
|
||||||
|
testClient = new Yavsc.Models.Auth.Client
|
||||||
|
{
|
||||||
|
Id = TestClientId,
|
||||||
|
DisplayName = "Testing Client",
|
||||||
|
Secret = TestClientSecret,
|
||||||
|
Active = true,
|
||||||
|
Type = ApplicationTypes.NativeConfidential,
|
||||||
|
AccessTokenLifetime = 900,
|
||||||
|
RefreshTokenLifeTime = 15000
|
||||||
|
};
|
||||||
|
dbContext.Client.Add(testClient);
|
||||||
|
dbContext.SaveChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnsureUser(string testingUserName)
|
public void EnsureUser(string testingUserName)
|
||||||
@ -113,7 +130,6 @@ namespace isnd.tests
|
|||||||
var userManager =
|
var userManager =
|
||||||
scope.ServiceProvider.GetRequiredService<UserManager<ApplicationUser>>();
|
scope.ServiceProvider.GetRequiredService<UserManager<ApplicationUser>>();
|
||||||
|
|
||||||
|
|
||||||
TestingUser = new ApplicationUser
|
TestingUser = new ApplicationUser
|
||||||
{
|
{
|
||||||
UserName = testingUserName,
|
UserName = testingUserName,
|
||||||
@ -130,7 +146,5 @@ namespace isnd.tests
|
|||||||
TestingUser = dbContext.Users.FirstOrDefault(u => u.UserName == testingUserName);
|
TestingUser = dbContext.Users.FirstOrDefault(u => u.UserName == testingUserName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user