katana

Owin WS-Federation setting up token sliding expiration

笑着哭i 提交于 2019-12-06 04:20:04
问题 Can somebody explain how to implement sliding expiration using the new Owin WS-Federation plugin? On the client side, at WS-Fedeartion configuration I see that there are some events like : Notifications = new WsFederationAuthenticationNotifications { SecurityTokenReceived = ..., AuthenticationFailed = ..., RedirectToIdentityProvider = ..., MessageReceived = ..., SecurityTokenValidated = .... }, But because the lack of documentation I can't really figure it out where an how? At the moment my

What is the process that makes IIS start responding to requests through the Owin pipeline?

让人想犯罪 __ 提交于 2019-12-06 01:27:24
问题 If you create an empty ASP.NET Web Application project in Visual Studio 2013 open the package manager console and install-package Microsoft.Owin.Host.SystemWeb Add a Startup class with a Configuration(IAppBuilder app) method, for example: public class Startup { public void Configuration(IAppBuilder app) { app.Run(context => context.Response.WriteAsync("hello")); } } And run, you'll see hello show up in the browser. However, it you look at the project, there's no change to any files, namely to

How are OwinContext.Request.Path and PathBase populated?

懵懂的女人 提交于 2019-12-05 17:46:52
问题 I'm writing my own OWIN middleware for OpenID Connect authorization code flow, based on other examples in the Katana Project. As part of this I have to construct a couple of URIs, eg a Redirect URI and a Return URL. Other examples in Katana do this by concatenating parts from the current request, for example in CookieAuthenticationHandler loginUri = Request.Scheme + Uri.SchemeDelimiter + Request.Host + Request.PathBase + Options.LoginPath + new QueryString(Options.ReturnUrlParameter,

How do you reject a Katana Bearer token's identity

会有一股神秘感。 提交于 2019-12-05 15:33:52
How can I reject An identity? My class inherits from OAuthBearerAuthenticationProvider and I have an override of ValidateIdentity? I have tried setting context.Rejected(); or context.SetError(); and throwing an exception but my controllers still get called. OAuthBearerAuthenticationHandler does call my class so I know I have the setup correct. my current failing code public void ConfigureAuth ( IAppBuilder app ) { // Enable the application to use a cookie to store information for the signed in user // and to use a cookie to temporarily store information about a user logging in with a third

How do I ask Owin/Katana to write headers to the output stream?

时间秒杀一切 提交于 2019-12-05 10:28:37
When I write to the response, Katana skips sending out the Elapsed-Time response header. How can I have it set the headers for me before I write to the stream for the first time? Middleware #1 public override async Task Invoke(IOwinContext context) { var stopwatch = new Stopwatch(); stopwatch.Start(); await Next.Invoke(context); stopwatch.Stop(); context.Response.Headers.Add("Elapsed-Time", new[] {stopwatch.ElapsedMilliseconds.ToString()}); } Middleware #2 public override async Task Invoke(IOwinContext context) { await context.Response.WriteAsync("test"); } After some research, the answer is

Web Api 2 HttpContext or HttpActionContext

ぃ、小莉子 提交于 2019-12-05 04:38:26
What is the difference between the following two ways of accessing the principle via an AuthorizeAttribute implementation? Using HttpContext : protected override bool IsAuthorized(HttpActionContext actionContext) { return HttpContext.Current.User.IsInRole("DemoRole"); } Using HttpActionContext : protected override bool IsAuthorized(HttpActionContext actionContext) { return actionContext.RequestContext.Principal.IsInRole("DemoRole"); } 来源: https://stackoverflow.com/questions/28235979/web-api-2-httpcontext-or-httpactioncontext

Owin self-host - Failed to listen on prefix 'http://localhost:12345/' because it conflicts with an existing registration on the machine

佐手、 提交于 2019-12-05 04:12:36
I'm trying to self-host a simple WebAPI: public class AccountViewApplication { protected IDisposable WebApplication; public void Start() { WebApplication = WebApp.Start<WebPipeline>("http://myhost.mymachine.me:12345"); new AccountViewApplication().Start(); } public void Stop() { WebApplication.Dispose(); } } The first time I run this, it starts to listen just fine, but the next time that I try - I get this: Failed to listen on prefix ' http://myhost.mymachine.me:12345/ ' because it conflicts with an existing registration on the machine What can I do to make it listen every time, and not

asp.net web api self hosting / owin / katana

徘徊边缘 提交于 2019-12-05 01:34:39
There are multiple question I have around self-hosting Self Hosting Nuget There are 2 nuget which provide self hosting : Microsoft.AspNet.WebApi.OwinSelfHost and Microsoft.AspNet.WebApi.SelfHost , so does microsoft have 2 implementation of self hosting?? or they are same?? Owin or Kitana the name of nuget is Microsoft.AspNet.WebApi.OwinSelfHost has OWIN, but as far as I read Owin is an interface and Kitana an implementation, what is the name of the nuget for implementation?? Hosting in Production I have managed to run the example by creating a console. But when deploying to prod, how to deploy

Owin WS-Federation setting up token sliding expiration

心不动则不痛 提交于 2019-12-04 10:14:48
Can somebody explain how to implement sliding expiration using the new Owin WS-Federation plugin? On the client side, at WS-Fedeartion configuration I see that there are some events like : Notifications = new WsFederationAuthenticationNotifications { SecurityTokenReceived = ..., AuthenticationFailed = ..., RedirectToIdentityProvider = ..., MessageReceived = ..., SecurityTokenValidated = .... }, But because the lack of documentation I can't really figure it out where an how? At the moment my STS is issuing tokens with absolute expiration : protected override Lifetime GetTokenLifetime(Lifetime

What is the process that makes IIS start responding to requests through the Owin pipeline?

有些话、适合烂在心里 提交于 2019-12-04 06:16:07
If you create an empty ASP.NET Web Application project in Visual Studio 2013 open the package manager console and install-package Microsoft.Owin.Host.SystemWeb Add a Startup class with a Configuration(IAppBuilder app) method, for example: public class Startup { public void Configuration(IAppBuilder app) { app.Run(context => context.Response.WriteAsync("hello")); } } And run, you'll see hello show up in the browser. However, it you look at the project, there's no change to any files, namely to web.config, that indicates that the Owin pipeline is being used. More importantly, if you have the