Questions tagged [cookie-authentication]

100 questions
0
votes
1 answer

Can we have normal login and azure ad sso login in asp.net mvc?

I have tried having a azure sso login in my existing application using the following link (https://learn.microsoft.com/en-us/azure/active-directory/develop/web-app-quickstart?pivots=devlang-aspnet). When i implemet it the normal login was not…
0
votes
0 answers

How to send a cookie in DRF-Spectacular Authorization?

I have written a custom backend for JWT authentication in cookies. I'd like to test it using the DRF-Spectacular. To this end, I've written the following scheme: from drf_spectacular.extensions import OpenApiAuthenticationExtension from .backends…
Karol Borkowski
  • 532
  • 7
  • 19
0
votes
0 answers

How to override CheckForRefreshAsync in CookieAuthenticationHandler?

I am using the default cookie based authentication in .Net 6. On successful authentication application is setting up cookie with sliding expiration as true as I want to refresh the token periodically. Frontend of application is also storing the…
0
votes
1 answer

ajax post request returns 400 Bad Request after refresh JWT Token

ASP.NET Core MVC 5. I am using Cookie Authentication with JWT Token as Claims for login authentication. I also have an AutoValidateAntiForgeryToken attribute on each controller to deal with XSRF. The JWT Token is set to expire in 30 minutes. In my…
0
votes
0 answers

Copy .NET Core authentication cookie to another browser works

I have a website project with .NET 6 (MVC) and I use an authentication cookie for authorizing users with this config: builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(options => { …
0
votes
0 answers

HttpContext.User has no claims even though the cookie is set

I have three websites let's say login.example.com dashboard.example.com conf.example.com in the login subdomain a cookie is set with multiple user claims, and then redirected to the dashboard where the cookie is read and the user is authenticated…
a.tolba
  • 137
  • 1
  • 1
  • 13
0
votes
2 answers

ASP.NET 6 Restful Api Cannot Authenticate with cookies

I am developing an ASP.NET 6 Restful API as a homework for collage. I would like to introduce AAA into my API. I have many allowed options and I've chosen Core Identity + cookies. I followed as many tutorials as I could, but to no avail. I don't…
0
votes
1 answer

Increase expiry time (Cookie)

we authenticate using the below approach, I am trying to figure out how I can increase the Expiry value in HttpContextAccessor.HttpContext when the user goes to a specific end point? var authProperties = new AuthenticationProperties …
user2612665
  • 91
  • 1
  • 2
  • 11
0
votes
1 answer

HttpContext.User in Asp.net core 3.1 + Angular with OpenIDConnect and external login

I am using Angular + Asp.net Core 3.1 Web api which is integrated with OpenIDConnect using Cookie Authentication for the Single Sign on(OneLogin).I am not not using Identity. Angular is published on Asp.net core on IIS ( same domain). Cookie…
0
votes
0 answers

Asp.NET Core Cookie Authentication Identifier

I'm using Cookie authentication for a Web API Core application, with OpenIdConnect. So far, I store JWT tokens in the cookies, and use a custom cache to keep a session-like data (in cache, the token is the key) Now i'd like to keep tokens on the…
drkmkzs
  • 159
  • 7
0
votes
0 answers

RedirectToLogin handler not called when a role is not fulfilled (cookie authentication)

I have a ASP.NET Core (.NET 6) API controller that makes sure that only authenticated users can access its endpoints using the Authorize attribute: [ApiController] [Authorize] [Route("api/borrower")] public class BorrowerController :…
Dejan
  • 9,150
  • 8
  • 69
  • 117
0
votes
1 answer

How to properly use RedirectToAction()

namespace AspWebAppTest.Controllers { public class AccountController : Controller { public IActionResult Login() { return View(); } [HttpGet] public IActionResult Login(string userName, string…
0
votes
1 answer

Blazor Server app with cookie authentication - Roles not working

I have a Blazor server app, I implemented cookie auth as shown in: https://www.pragimtech.com/blog/blazor/asp.net-core-identity-setup-in-blazor-application/ I can succesfully protect my page with and @attribute [Authorize]. But I…
Mart Apon
  • 69
  • 1
  • 1
  • 8
0
votes
0 answers

How to manually generate authentication cookie in asp.net core?

I want to manually generate the authentication cookie string on the server side, that is generated by ASP .NET core when you have setup cookie authentication middleware and you sign-in the user using SignInAsync(this HttpContext context, string?…
0
votes
1 answer

.NET Core Shared Cookies

I have .NET Core app with .NET Core Identity. I've setup shared cookie into Startup.cs: services.AddIdentity() .AddEntityFrameworkStores() .AddDefaultTokenProviders(); services.ConfigureApplicationCookie(options…
A. Gladkiy
  • 3,134
  • 5
  • 38
  • 82