问题标签 [katana]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
asp.net-web-api - Katana / OWIN 调试和 app.UseErrorPage
到今天为止,我有一些时间进行研发,并且一直在玩 OWIN。
我希望为所有数据交互运行一个 OWIN WebAPI 服务,以及一个使用 Angular 的单独的 Web 前端 SPA 项目。
所有代码都是从各种随机博客文章中无耻地窃取的,只是为了掌握这种“新技术”。
启动
账户控制器
如果我导航到 [http://localhost:85/fail],我会看到一个非常性感的错误页面。
但是当我点击[http://l0calhost:85/api/accounts/5]时,错误被暴露为 json/xml。
- 有什么方法可以强制 API 控制器异常也使用 AppBuilder 错误机制?
- 这会被人反对吗?(感觉有点脏……)
.net - Microsoft.AspNet.Identity 源代码可用性
谁能告诉我,我在哪里可以找到 Microsoft.AspNet.Identity.Core 和 Microsoft.AspNet.Identity.EntityFramework 包的源代码?
c# - 自托管 Owin 端点中的客户端证书映射身份验证
是否可以(如果可以,如何?)配置一个自托管的 owin 端点以使用带有 A/D 的客户端证书映射身份验证?IIS 有这个功能链接,但到目前为止我还没有找到自托管端点的等价物。
虽然我得到这个工作的方式(记住这种方法可能不是 100% 万无一失的),是通过结合使用 authenticationSchemeSelectorDelegate 和 OWIN 的两步过程。
这将选择适当的 AuthenticationScheme(允许包含证书的请求通过,否则推迟到 NTLM 身份验证)
这将读取证书的内容并相应地填充“server.User”环境变量
没有更好/标准化的方式吗?
asp.net - 使用 Microsoft.Owin.Testing.TestServer 进行内存集成测试的身份验证
我刚刚开始将 OWIN\Katana 用于 Web api 项目。它使用 Windows 身份验证。这似乎有效,但我的大多数集成测试都失败了。他们以前只是使用 In-Memory HttpServer
,但我已改为使用Microsoft.Owin.Testing.TestServer
. 我在我的测试设置中替换了这样的东西:
用一个更简单的:
但是以前我可以将以下内容用于内存服务器的“假”身份验证:
现在这行不通了。对于所有请求,我得到以下信息:
如何使用 In-Memory OWIN 测试服务器进行身份验证或至少绕过身份验证?
asp.net - 在 ASP.NET 中可用的 Owin/Katana 中缺少什么?
我希望在 .NET 4.0 上使用 WebAPI 和 html 前端构建一个小型 ASP.NET 应用程序。我需要支持身份验证、授权、数据访问 (EF)、日志记录/跟踪。它可以是一个内网/互联网应用程序,所以它应该支持负载均衡/集群。我确信如果我只使用 ASP.NET 和 IIS,我将获得所有这些功能。但是,我喜欢 OWIN 的独立异步模块的想法及其成为高性能托管环境的目标。但是 OWIN/KATANA 有多少成熟了,哪些功能仍然缺失/有缺陷?
asp.net - 在 MVC5 应用程序中使用 OWIN 包的好处
我正在尝试了解 OWIN 和 Katana。当然,应用程序可以自托管或托管在 Nancy 或非 IIS 上,这很酷。这个问题的原因是我们想使用 MVC5 (VS 2013) 创建一个 Web 应用程序,它将托管在 Windows Azure 中的 IIS 上。
但是,我们收到了在 mvc5 应用程序中使用 OWIN 中间件组件/包的建议,以获得可插拔架构、性能等方面的好处。
我想了解如果我们在 MVC5 应用程序中使用 OWIN 中间件将如何提高性能,该应用程序将托管在 Windows Azure 中的 IIS 上。我的应用程序会通过使用 owin 中间件包跳过 IIS 管道中的许多不必要的事情吗?在 IIS 上托管时,在 MVC5 中使用 OWIN 是否还有其他好处?
asp.net-web-api - System.Web.Http.WebHost 中的 GlobalConfiguration 是否与 Owin 兼容?
我目前正在使用 OWIN 将 WebApi 1 移动到 WebApi 2 项目。
在这段代码中,GlobalConfiguration 在 System.Web.Http.WebHost 中。
我认为这与 Owin 不兼容,但我找不到如何重写它,因此我可以访问依赖解析器。
c# - Nancy.Owin 错误传递到 Owin AppBuilder 管道?
我有一个 NancyFx.OWIN 应用程序。我正在尝试利用 Katana 的诊断“ErrorPage”(来自http://www.nuget.org/packages/Microsoft.Owin.Diagnostics/2.0.0)来显示从我的 NancyModules 返回的错误响应。
(这里是武士刀错误页面的屏幕截图:http: //miso-soup3.hateblo.jp/entry/2013/10/30/205653)
虽然我可以将 IAppBuilder 上下文中的错误显示到此页面,但不幸的是,我无法从 Nancy 那里获得错误响应。
我的 Owin 启动看起来像这样:
这个功能如下: 1.“/hello”显示 Microsoft.Owin.Diagnostics 蓝色笑脸欢迎页面 2.在我的 NancyModules 函数中定义的路由如预期 3.HttpStatusCodes != InternalServerError 由 Nancy 处理(显示“绿色怪物”视图)
但是,当返回 InternalServerError 状态代码时,OWIN IAppBuilder 管道会忽略它们。因此,当我到达以下南希路线时:
由于我的以下 Nancy 异常管道将所有异常格式化为 InternalServerError 的响应,我希望错误被格式化并呈现为“UseErrorPage()”功能:
但是什么都没有显示。我知道管道错误响应作为响应被发回,并且 Nancy 正在传递它,但不知何故 UseErrorPage() 没有捡起它......当我删除传递时,“错误!” 在浏览器中显示为文本。任何想法如何将 NancyFx 的错误响应连接到 Owin.IAppBuilder 管道中?
c# - OWIN Webapi 应用程序在与 nuget 捆绑时收到“System.ArgumentException 没有可用的转换...”
我正在尝试设置一个自托管的 OWin 应用程序(使用 VS2012) - 我认为它很接近,因为我可以从包含 .csproj 的目录运行 OwinHost.exe 并且应用程序从 localhost:5000 正确地提供服务。我创建了一个默认的 nuspec 文件并添加了以下内容
在 AssemblyInfo.cs
当我安装软件包( nuget install mypackage )时,出现以下错误...
从默认端口开始:5000...
如果您想了解更多信息,请告诉我
干杯!
authentication - With OWIN/OAuth2, calling GET prevents Windows identity from arriving with subsequent POSTs to the token endpoint
In what seems like an elementary scenario, calling a GET method in my OAuth2/OWIN-protected server prevents the server from receiving the Windows identity on subsequent POSTS to the /token endpoint. What am I doing wrong?
This is a Web API service that includes an embedded OAuth2 authorization server and Microsoft's OWIN pipeline.
The authorization server provider inherits from OAuthAuthorizationServerProvider
, and is installed in my Startup
class. It overrides both GrantResourceOwnerCredentials
(for username/password authentication) and GrantClientCredentials
(for the client_credentials grant_type).
Here's the problem. If I configure the service for Windows authentication the following ensues.
- Client POSTS to my /token endpoint to get a token.
- Client's Windows identity arrives at the server in the
GrantClientCredentials
method's context parameter (specifically,context.Request.User
). I can give him an appropriate token usingcontext.Validated(id)
, where id is aClaimsIdentity
appropriate to his credentials. - Let's say client even POSTS again to get another token. Again, his credentials come to the server in
context.Request.User
. All is well. - Client does a GET to my API endpoint, including the token.
- Server can inspect the claims in the token. All is still well.
- Either the same client or a different client POSTs to get another token.
- This time,
context.Request.User
arrives as null. PROBLEM!!! - If I restart the server, everything is set right. Restarting the browser does not help.
These symptoms happen whether running with IIS Express or real IIS.
The problem exists only for Windows authentication. When Anonymous authentication is turned on and a username/password duo passed, the credentials arrive safely in step 7.
FWIW, I have not yet programmed anything pertaining to a client_id
or "secret". Still working on figuring that part out. If that's the problem, I'd appreciate help in how to issue a client_id and secret.