owin

Syncing OWIN Cookie Expiration (sliding) and session timeout

☆樱花仙子☆ 提交于 2019-12-22 08:32:47
问题 Background I have a semi-single-page application (all server interaction after login takes place on one page via ajax calls) that uses both session storage and OWIN cookie authentication. Both session and cookie expiration are set to 15 minutes and the cookie is configured to use sliding expiration. On every server interaction, a timer on the client is reset back to 15 minutes. If no activity is recorded for 14 minutes, a modal is displayed with a ticker alerting the user that the session

OWIN Authentication and Custom Response

ⅰ亾dé卋堺 提交于 2019-12-22 06:47:17
问题 I create a custom BasicAuthenticationMiddleware that use a BasicAuthenticationHandler to Authenticate requests from client to WebAPI. The BasicAuthenticationHandler derives from the AuthenticationHandler< TOptions > base class. Everything works fine and I implemented the AuthenticateCoreAsync where the logic to authenticate happens ApplyChallengeResponseAsync where the logic, in case of not authenticated requests, sends the WWW-Authenticate header to the client. What I would like to achieve

Web Api 2 with OWIN OAuth Bearer tokens

眉间皱痕 提交于 2019-12-22 05:52:10
问题 I'm in the process of building a web api in visual studio 2013 and want to authenticate using OWIN middleware and bearer tokens. However I already have a database and don't want to use Microsoft's new Identity framework as the majority of tables and columns that it auto generates I simply don't need. Can anyone point me in the right direction of how to apply this type of authentication without having to use the Microsoft Identity framework? 回答1: My suggestion would be to use the framework but

Custom Asp.net mvc 5 authentication without using Microsoft.AspNet.Identity.EntityFramework

安稳与你 提交于 2019-12-22 05:33:28
问题 How do you create a custom ASP.NET MVC 5 Auth without using the UserStore of Microsoft.AspNet.Identity.EntityFramework?? 回答1: All you have to do is implement the same interfaces that the Userstore for Identity.Entityframework uses. User will be your user class public class MyUserStore<TUser> : IUserLoginStore<TUser, int>, IUserClaimStore<TUser, int>, IUserRoleStore<TUser, int>, IUserPasswordStore<TUser, int>, IUserSecurityStampStore<TUser, int>, IUserStore<TUser, int>, IDisposable where TUser

ASP.NET Identity doesn't update Identity information on same request

风流意气都作罢 提交于 2019-12-22 05:32:06
问题 I am working on a single page application using AngularJS and ASP.NET Identity 2. I log the user in and the cookie is set; however, when I check the Identity of the user on the same request, it shows it as blank and IsAuthenticated is false. However, these are populated on subsequent requests. I was hoping to send back to the UI whether or not the user was logged in on the same request. Is this possible? Code as requested (AngularJS makes AJAX post into WebAPI controller Login method)

HttpContext.Current is null on TokenCache.BeforeAccess

感情迁移 提交于 2019-12-22 05:20:19
问题 I am testing a webproject using OWIN and OpenID Connect against Azure AD. I am using much of the code from this sample: https://github.com/Azure-Samples/active-directory-dotnet-webapp-webapi-openidconnect I have an issue where i get a null exception on line 27 of this file: https://github.com/Azure-Samples/active-directory-dotnet-webapp-webapi-openidconnect/blob/master/TodoListWebApp/Utils/NaiveSessionCache.cs I get the exception because HttpContext.Current is null. I can see that Load() is

MVC 5 Redirect to Login Page Not Working with OWIN

血红的双手。 提交于 2019-12-22 05:03:54
问题 I'm trying to get my head around using OWIN. I have created two MVC 5 projects. One with authentication using Aspnet.Identity and the other started as an empty project. I added the following to the emptyp project: Account controller with a Login action and coresponding view Startup.cs and another partial Startup.cs with public partial class Startup { public void ConfigureAuth(IAppBuilder app) { app.UseCookieAuthentication(new CookieAuthenticationOptions { AuthenticationType =

asp.net web api self hosting / owin / katana

喜你入骨 提交于 2019-12-22 03:49:03
问题 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

What URL does OWIN understand for ipv6 self-hosting?

爷,独闯天下 提交于 2019-12-22 03:44:04
问题 My application uses self-hosting feature of ASP.NET Web API. NuGet package name I use is Microsoft.AspNet.WebApi.SelfHost. I used following example as a base. Following code works for me to launch host on ipv4 localhost endpoint: WebApp.Start<Startup>("http://127.0.0.1:43666"); What do I enter if I want to specify ipv6 address? "http://[::1]:43666" does not work. Exception thrown is [reformatted]: System.Net.HttpListenerException: The network location cannot be reached. For information .

How to set Claims from ASP.Net OpenID Connect OWIN components?

风流意气都作罢 提交于 2019-12-22 01:50:37
问题 I have questions upon using the new ASP.Net OpenID Connect framework while adding new Claims during the authentication pipeline as shown in the code below. I'm not sure just how much 'magic' is happening behind the scenes. I think most of my questions center around not knowing much about OWIN authentication middleware as opposed to OpenID Connect. Q1. Should I be manually setting HttpContext.Current.User and Thread.CurrentPrincipal from OwinContext.Authentication.User ? Q2. I want the ability