Questions tagged [cookie-authentication]

100 questions
2
votes
1 answer

ASP.NET framework 4.8 cookie authentication provider does not trigger onValidateIdentity

I'm using the ASP.NET framework CookieAuthenticationProvider to generate an identity with AspNet.Identity.Core version 2.2.2. The cookie seems to be correctly generated when I look at it from the front end (the CookieName, CookieDomain are all like…
Luke_
  • 745
  • 10
  • 23
2
votes
1 answer

How to detect and logout the user from an application if he logins from another browser/device in IdentityServer4?

I have implemented the IdentityServer4 SSO in my application. SSO works fine as well as Logout for all the clients,However there is a new requirement where if the user is already logged in into an application and if he tries to login again (From…
2
votes
1 answer

CookieAuthentication cookies are invalid after application pool recycle

I have a .net core project using Microsoft.AspNetCore.Authentication (2.2.0) configured to use CookieAuthentication. Cookies are configured to be persistent and expire after seven days. The problem is that all logged-in users are logged out whenever…
Oskar Sjöberg
  • 2,728
  • 27
  • 31
2
votes
0 answers

Authentication cookie is not saved by browser

I have a user info endpoint in my webapi which is protected by [Authorize] and the cookie authentication. If the designated cookie is not present then the user is redirected to /account/login, which looks something like below. var…
Sayan Pal
  • 4,768
  • 5
  • 43
  • 82
2
votes
3 answers

AuthorizeAttribute redirecting to an incorrect url when deployed to a website with a subdomain

Normally (on my localhost for example), [Authorize] correctly redirects to LoginPath specified in the CookieAuthenticationOptions. However, when I deploy to my staging site (staging.mysite.com), the authorize redirection seems to misplace part of…
2
votes
0 answers

How to access ASP.NET Core WebAPI (using cookie authentication) from Angular

I'm trying to access a ASP.NET Core (1.1.2) WebAPI from Angular (version 7) which uses cookie authentication. The backend for the Angular application uses ASP.NET Core 2.1.1 and JWT token authentication. Do I need to return the cookie in response…
2
votes
0 answers

Reason to use JWT instead of Cookie authentication for Web Api in ASP.NET Core

According to this (on youtube) conference, we should not use Cookie authentication for Web Api, because in case there are multiple servers on the same domain, there is a possibility for CSRF attack. another source He says the following: "we should…
2
votes
0 answers

Encrypting Authentication Cookies using Data Protection Keys Stored in Database for .Net Core and .Net Framework 4.x Websites

Question: How can I encrypt authentication cookies using data protection keys stored in a database rather than the file system or file share for Asp.Net Framework 4.x and Asp.Net Core 2 websites? Context: I have a .Net Framework 4.x website and a…
1
vote
0 answers

Why in Blazor-Server (Cookie authentication) SignalR don't send cookies to the server automatically?

In the Microsoft docs written: In a browser-based app, cookie authentication allows existing user credentials to automatically flow to SignalR connections. When using the browser client, no extra configuration is needed. If the user is logged in to…
1
vote
0 answers

Cookie authentication is working in local but no publised (ASP.NET Core 6.0 application)

I have a problem with my cookie authentication, in localhost it is working good but when I publish it on a server I am disconnected after 40 seconds each time. It seems like the expiration of cookies is configured. So I really can't understand what…
1
vote
1 answer

Umbraco V10 - How to add login via Cookie Authentication

So we have been migrating an umbraco project from version 8 to version 10, from .NetFramework to .NetCore 6. Most of the code has move overly nicely but one of the last things left to convert over is front end logins using Cookie Authentication. The…
Rhys
  • 11
  • 4
1
vote
2 answers

How to update user claims stored in authentication cookie in .NET Core 6

I have a Razor Pages app developed using .NET Core 6. The app works as a client and connects to an API. The API has JWT Access Token/Refresh Token authentication. The login endpoint of the API returns access token and refresh token.Using cookie…
Divyang Vyas
  • 65
  • 1
  • 8
1
vote
1 answer

ASP .Net Core, Store JWT in Cookie

I heard its one of the most safety way to store JWT. My question is. How can I save it in cookie? Here is the function in ConfigureServises in Startup.cs services.AddControllers(); services.AddTransient(); …
1
vote
0 answers

How to use Windows authentication as an alternative to password login? ASP.NET Core

I want to implement the following functionality: I have a website I'm creating in ASP.NET Core 6 and it will be both accessible from inside and outside of the server's network. When accessed from the outside, I only want to enable password login.…
1
vote
1 answer

Blazor Set-Cookie not effective

I'm trying to set up Cookie Authentication in Blazor WebAssembly, running in Chrome. WebApp runs on https://localhost:44342 WebApi runs on https://localhost:44377 After a post request (with PostAsJsonAsync) to https://localhost:44377/user/loginuser…