我可以使用MemoryCache在ITicketStore存储的AuthenticationTicket?
背景:我的网络应用程序使用Cookie身份验证:
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AutomaticAuthenticate = true,
AutomaticChallenge = true,
LoginPath = new PathString("/Authentication/SignIn"),
LogoutPath = new PathString("/Authentication/SignOut"),
ReturnUrlParameter = "/Authentication/SignIn"
});
Run Code Online (Sandbox Code Playgroud)
我的web api使用访问令牌(OAuth2)处理授权过程.
有时(在某些浏览器上)会抛出以下异常:
发生了未处理的异常:chunked cookie不完整.仅发现预期的2个块中的1个,总共4021个字符.可能已超出客户端大小限制.
cookie显然太大了.这很奇怪,因为我没有使用很多说法.所有这些都是默认声明(nameidentifier,nonce,exp等).我现在想实现我自己ITicketStore的SessionStore上CookieAuthenticationOptions.的AuthenticationTicket将被存储在一个MemoryCache(像这样在样品).我对这整个主题都很陌生,并且不确定,如果这是一个好的方法,并且它MemoryCache是一个有效的解决方案.
我添加了一个对我的 GitLab 存储库具有写访问权限的部署密钥。我的.gitlab-ci.yml文件包含:
- git clone git@gitlab.domain:user/repo.git
- git checkout master
- git add myfile.pdf
- git commit -m "Generated PDF file"
- git push origin master
Run Code Online (Sandbox Code Playgroud)
克隆存储库时部署密钥有效。即使部署密钥具有写入权限,也无法进行推送。
remote: You are not allowed to upload code.
fatal: unable to access 'https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@domain/user/repo.git/': The requested URL returned error: 403
Run Code Online (Sandbox Code Playgroud) 在 MVC 控制器中,我用来AssemblyLoadContext.Default.LoadFromAssemblyPath(pathToDll);加载程序集。我想在运行时删除或替换给定的 .dll 文件。这是不可能的,因为该文件没有被释放。有什么方法可以处理.dll 文件吗?有一些使用该类AppDomain的解决方案,但在 ASP.NET Core 中不可用。
背景:用户可以上传包含给定接口实现的自定义 .dll 文件。用户还应该能够替换他的文件。我在控制器中使用以下代码来访问实现:
var conventions = new ConventionBuilder();
conventions
.ForTypesDerivedFrom<IPluginContract>()
.Export<IPluginContract>()
.Shared();
var configuration = new ContainerConfiguration().WithAssembliesInPath(path, conventions);
using (var container = configuration.CreateContainer())
{
var plugins = container.GetExports<IPluginContract>();
return plugins;
}
Run Code Online (Sandbox Code Playgroud)
和
public static ContainerConfiguration WithAssembliesInPath(
this ContainerConfiguration configuration,
string path, AttributedModelProvider conventions,
SearchOption searchOption = SearchOption.TopDirectoryOnly)
{
var fileNames = Directory
.GetFiles(path, "*.dll", searchOption);
List<Assembly> assemblies = new List<Assembly>();
foreach (string relativePath in fileNames)
{ …Run Code Online (Sandbox Code Playgroud) 我有一个带有web api,web应用程序和Xamarin应用程序的项目.它们都应该使用存储在AspNetCore库中的相同数据模型.我想将EF Core用于数据库,我有一个Db管理项目(也是一个AspNetCore库),引用了包含上下文和设置的EF Core.web api是引用此Db Managing项目的唯一项目,因为它处理所有数据库访问.所有其他应用程序都在联系web api进行数据交互.
我的问题:我想使用AspNetCore.Identity进行用户管理,但是当使用AspNetCore.Identity时,Xamarin Apps无法引用数据模型.我怎么解决这个问题?
architecture entity-framework xamarin asp.net-identity asp.net-core