问题标签 [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.

0 投票
1 回答
2171 浏览

asp.net-web-api - 使用 api2.1 从不记名令牌中获取自定义声明值

感谢@leastprivilege,我离我想要实现的目标更近了。

我在声明中添加了一些自定义值(不是我自己的原创作品!!)

更新 Auth.Startup 文件后

我尝试通过以下方式访问声明类型角色

但是,通过挖掘我似乎找不到任何对 ClaimTypes.Role 的引用。

我是否试图以错误的方式访问该角色?

0 投票
2 回答
614 浏览

asp.net-mvc - Web API [Authorize] Attribute Without User Logging In Or Requesting Token With Password?

Correct me if I'm not understanding something. I'm working with a fresh Web API application generated from a VS template.

  • The user does register right on the login page of the Web API app.
  • It appears that a user can register from outside the Web API app (from ANY device that knows the api/Accounts URL), but it requires passing sensitive information in plain text.
  • The sample ValuesController has the [Authorize].
  • Accessing /api/Values from the browser will throw a 401 if the user is not logged in.
  • Accessing /api/Values from Fiddler will also throw a 401 even if the user is logged in. This is because it requires an Authorize: Bearer header, which the access token isn't available from outside the web application.
  • There is a token endpoint that we can use to request a token from outside the app, but using the built-in token endpoint requires the user's username and password as plain text to be sent.

I guess all the work needs to be done from an external trusted client application (which must have access to the same database that stores user info). From the client application, how would I create an access token so that I can make a request that would have that access token in the header?

Suppose that I was able to achieve generating an acceptable access token from the client. Will the [Authorize] attribute still block access because the user would technically not be logged in? Or does [Authorize] actually log the user in if it doesn't result in a 401?

0 投票
1 回答
920 浏览

security - AccountController GetExternalLogin 方法

谁能向我解释一下 GetExternalLogin 方法。我想从这个方法重定向到另一个位置,但是每当我这样做时,来自外部提供商的访问令牌就会从 url 中消失。成功登录后,此方法中的访问令牌详细信息会留在哪里?

0 投票
1 回答
5160 浏览

node.js - OWIN Katana 与 Node.js 性能基准测试

OWIN Katana 和 Node.js 哪个是可靠的性能基准?我对所有已经用 Katana 测试和尝试过的东西都非常感兴趣。

0 投票
5 回答
9413 浏览

asp.net-mvc-4 - GoogleOauth2 问题获取内部服务器 500 错误

我决定试一试新的 Google Oauth2 中间件,它几乎破坏了一切。这是我来自 startup.auth.cs 的提供程序配置。打开后,包括 google 提供程序在内的所有提供程序都会在 Challenge 上获得 500 个内部服务器。但是,内部服务器错误的详细信息不可用,我无法弄清楚如何为 Katana 中间件打开任何调试或跟踪。在我看来,他们似乎急于将 google Oauth 中间件推出市场。

动作方法代码:

0 投票
1 回答
1607 浏览

owin - OwinHost.exe 不适用于类库项目

我用以下启动类创建了一个新的类库项目:

我安装了以下软件包:

当我尝试从中运行owinhost.exe时,/bin/debug出现以下错误:

我是否需要做任何其他事情才能让 OwinHost.exe 与类库项目一起工作(我在控制台应用程序中遇到了同样的问题)。

0 投票
2 回答
2712 浏览

asp.net-mvc-5 - MVC5 UseGoogleAuthentication mysterios 方法

这可能是一个愚蠢的问题,但我在互联网上没有找到答案。我看到了 MVC5 和 oAuth 的以下代码

app.UseFacebookAuthentication app.UseGoogleAuthentication();

但是,我在调试器中的 app 对象上没有看到任何名为 UseGoogleAuthentication 的方法。我确实在 Katana 代码中看到了 AppBuilder 上的“使用”方法。那么发生了什么?从哪里这个“app.UseGoogleAuthentication();” 神秘手段要来了?我确定我错过了一些约定,但它是什么?

提前致谢

0 投票
1 回答
1797 浏览

asp.net - 对象被处理得太早了?

这让我很困惑。我有这个 OWIN/Katana 中间件:

然后是一个启动类:

运行此程序会在 M1 中引发 ObjectDisposedException:

无法访问已处置的对象。对象名称:“System.Net.HttpListenerRequest”。

堆栈跟踪:

在 System.Net.HttpListenerRequest.CheckDisposed() 在 System.Net.HttpListenerRequest.GetKnownHeader(HttpRequestHeader 标头) 在 System.Net.HttpListenerRequest.get_UserHostName() 在 Microsoft.Owin.Host.HttpListener.RequestProcessing.RequestHeadersDictionary.TryGetValue(String key, String[]& value) 在 Microsoft.Owin.HeaderDictionary.TryGetValue(String key, String[]& value) 在 Microsoft.Owin.Infrastructure.OwinHelpers.GetHeaderUnmodified(IDictionary 2 headers, String key) at Microsoft.Owin.Infrastructure.OwinHelpers.GetHeader(IDictionary2 headers, String key) 在 Microsoft.Owin.Infrastructure.OwinHelpers .GetHost(IOwinRequest 请求) 在 Microsoft.Owin.OwinRequest.get_Host()

如果我在app.Use();之前删除该匿名中间件;那么不会抛出异常。

我做错了吗?

0 投票
1 回答
225 浏览

c# - nuget 包“Microsoft ASP.NET Web API 2.1 OWIN Self Host 5.1.1”使用的主机是什么?

nuget 包Microsoft ASP.NET Web API 2.1 OWIN Self Host 5.1.1用于托管 webapi 2.1 的主机/网络服务器是什么?

(按照此页面中的主机依赖项,​​它确实会导致Katana 服务器,但我想确保)

0 投票
1 回答
2737 浏览

asp.net - 适用于 .NET 4.5 和 Angular 的单页应用程序项目模板

作为使用 Microsoft 堆栈的 Web 开发人员,是否有过更令人困惑/困难的时期?那不是我的问题……我知道答案是绝对不。:)

VS 2013 自带的单页应用模板很可悲

我一直在努力构建一个在客户端上使用 Angular JS 的类似项目模板,但我开始转动我的轮子,稍微移植外部(openId/oauth)登录功能。

我相信这是因为缺乏关于 Katana 的身份验证/安全位的良好、单点真实和当前的文档,还因为客户端代码在 Visual Studio 2013 的 SPA 模板中是多么不可读

我知道我可以度过难关,但是当我为此苦苦挣扎时,我想知道:

是否存在任何使用 .NET 4.5 (MVC5/Web Api 2)、Angular JS、新的 ASP.NET Identity 和 Katana 包的良好社区提供的项目模板或示例代码库?

HotTowel.Angular,但它对安全没有立场。此外,它是一个 Nuget 包,它不能或不应该像适当的项目模板那样指定。