草庐IT

Aspnetcore-identityserver

全部标签

xml - ASPNetCore API 内容协商不起作用

我正在尝试设置我的api,以便它根据Acceptheader使用XML或JSON进行响应。我正在学习ShawnW的教程:https://wildermuth.com/2016/03/16/Content_Negotiation_in_ASP_NET_Core它说要添加一个包到:"Microsoft.AspNet.Mvc.Formatters.Xml":"6.0.0-rc1-final"但我找不到它,所以安装了:Microsoft.AspNetCore.Mvc.Formatters.Xml他说要将它添加到Startup的配置服务部分://Addframeworkservices.serv

c# - .Net Core 中的 .AspNetCore.Antiforgery.xxxxxxx cookie 是什么?

我试图在.NetCore中使用ValidateAntiForgeryToken,但我得到的是.AspNetCore.Antiforgery.xxxxxxxcookie丢失。这个.AspNetCore.Antiforgery.xxxxxxxcookie是什么? 最佳答案 ASP.NETCore查找此cookie以找到X-CSRFtoken。TheValidateAntiForgeryTokenisanactionfilterthatcanbeappliedtoanindividualaction,acontroller,orgloba

c# - 如何设置 SwashBuckle.AspNetCore.Swagger 以使用授权?

我已经使用Swashbuckle.AspNetCore.Swagger记录了我的api,我想使用swaggerui测试一些具有Authorize属性的资源。接口(interface)usingMicrosoft.AspNetCore.Authorization;usingMicrosoft.AspNetCore.Mvc;usingSystem.Linq;namespaceApi.Controllers{[Route("[controller]")][Authorize]publicclassIdentityController:ControllerBase{[HttpGet]publi

c# - 找不到 Microsoft.AspNetCore.Antiforgery

我正在将asp.netcore2.0网站部署到IIS10。我已确保我的应用在program.settings文件中使用正确的ISS配置。publicclassProgram{publicstaticvoidMain(string[]args){BuildWebHost(args).Run();}publicstaticIWebHostBuildWebHost(string[]args)=>WebHost.CreateDefaultBuilder(args).UseKestrel().UseContentRoot(Directory.GetCurrentDirectory()).UseI

c# - 通过 ASP Core MVC、Web API 和 IdentityServer4 的身份验证?

我一直致力于将单体ASPCoreMVC应用程序迁移到使用服务架构设计。MVC前端网站使用HttpClient从ASPCoreWebAPI加载必要的数据。一小部分前端MVC应用程序还需要使用IdentityServer4(与后端API集成)进行身份验证。这一切都很好,直到我将Authorize属性放在WebAPI的Controller或方法上。我知道我需要以某种方式将用户授权从前端传递到后端才能使其正常工作,但我不确定如何进行。我尝试获取access_token:User.FindFirst("access_token")但它返回null。然后我尝试了这个方法,我能够得到token:va

c# - IdentityServer4/Newtonsoft.Json 中的探查器 BLOCKED_TIME

我遇到的问题是我的IdentityServer的/connect/introspect端点有时真的很慢(一次调用需要10秒)。正如您在下面看到的,大多数调用(18k)执行得很快(我启用了新的ApplicationInsightsprofiling大多数缓慢的轨迹看起来像这样:正如在ApplicationInsightsprofilerpage上所说:BLOCKED_TIMEindicatesthecodeiswaitingforanotherresourcetobeavailable,suchaswaitingforasynchronizationobject,waitingforat

c# - 始终返回 IdentityServer "invalid_client"错误

我正在尝试使用IdentityServer3,但不知道为什么我总是收到“invalid_client”错误,无论我做什么。这是我正在使用的代码://Startup.cs(Authc#project)publicvoidConfiguration(IAppBuilderapp){varinMemoryManager=newInMemoryManager();varfactory=newIdentityServerServiceFactory().UseInMemoryClients(inMemoryManager.GetClients()).UseInMemoryScopes(inMem

c# - 命名空间 'Hosting' 中不存在类型或命名空间名称 'Microsoft.AspNetCore.Razor'

我使用VisualStudio.NETCore2.1SDK+React模板创建了一个项目。我在运行项目时遇到了以下错误:Oneormorecompilationreferencesaremissing.Ensurethatyourprojectisreferencing'Microsoft.NET.Sdk.Web'andthe'PreserveCompilationContext'propertyisnotsettofalse.Thetypeornamespacename'Hosting'doesnotexistinthenamespace'Microsoft.AspNetCore.R

javascript - 如何在 ClientCredentials ASP.NET Core 中使用 IdentityServer4 和 Javascript 客户端

我正在实现IdentityServer4,我正在制作3个不同的项目:身份服务器(http://localhost:5000)API(http://localhost:5001)Javascript客户端(http://localhost:5003)所有项目均使用ASP.NETCore创建,但JS客户端使用静态文件。我需要JS客户端仅使用身份token(而非访问token)与API连接,因为我只需要访问API,不需要管理用户身份验证。我正在阅读快速入门帖子https://identityserver4.readthedocs.io/en/dev/quickstarts/1_client_

javascript - 使用 Identity Server 4 和 ASP.NET Identity 添加外部登录

在使用带有ASP.NETIdentity的IdentityServer4添加身份验证功能后,我计划添加GoogleProvider,以便用户也可以使用他们的google+帐户登录。我使用Angular作为前端,使用ASP.NETWebApi(Core)作为后端。//Loginclientpubliclogin(email:string,password:string):Observable{letbody:any=this.encodeParams({/*cliend_id,grant_type,username,password,scope*/});returnthis.http.p