Questions tagged [cookie-authentication]
100 questions
1
vote
0 answers
Refresh ClaimsPrincipal after HttpContext.SignInAsync (without identity)
I'm building a ASP.NET Core 2.1 web app. I am not using Identity. I am using CookieAuthentication.
Instead, I sign-in the user using…

John-Luke Laue
- 3,736
- 3
- 32
- 60
1
vote
0 answers
Authentication cookie always deleted after validateInterval using CookieAuthenticationProvider OnValidateIdentity
Background skip if you like
I am working on a .NET (4.5.2) web application which uses CookieAuthentication and OpenIdConnectAuthentication (integrated with Azure AD) provided by OWIN middleware.
A penetration test from the client has highlighted…

Phil Bellamy
- 310
- 3
- 11
1
vote
0 answers
User.identity.name is null in cookie authentication in .net core
I am using cookie authentication and authorization in .Net Core. My issue is after SignInAsync, I am getting User.identity.name null and also claims count 0.
Here is my controller code
ClaimsIdentity identity = new ClaimsIdentity(new[] {
…

Hunzla Ali
- 383
- 2
- 5
- 22
1
vote
2 answers
DataProtectionBuilder.ProtectKeysWithAzureKeyVault not working in .net 4.7.2
ProtectKeysWithAzureKeyVault is not pulling key from Azure KeyVault using .net 4.7.2.. But it works well in .netcore 2.2
I do the following:
public void ConfigureAuth(IAppBuilder app)
{
app.UseCookieAuthentication(new…

PrasannaBhat
- 11
- 4
1
vote
0 answers
Bearer authentication scheme with MVC page requests
Am using bearer authentication scheme to secure my webApp which built with angularjs for frontend and Asp.net webApi for backend and it works great with me.
I modifided the $http service to add common authentication header "JWT token".
Now new…

Wessam Al-Bakary
- 91
- 2
- 5
1
vote
0 answers
Prevent multiple login in asp.net MVC 4 application
A system need single user login at a time. If tried for multiple login simultaneously the user get blocked. I have used Cookie Authentication which will manage from client browser.
Login Code:
[HttpPost]
[ValidateAntiForgeryToken]
…

Shubham Mondal
- 31
- 11
1
vote
2 answers
CouchDB can't get cookie auth session for nonadmin user
For admin user:
$ curl -X POST localhost:5984/_session -d "username=admin&password=admin"
{"ok":true,"name":"admin","roles":["_admin"]}
$ curl -vX GET localhost:5984/_session --cookie AuthSession=YWRtaW... …

cgwic
- 52
- 6
1
vote
0 answers
asp.net core 2.0 cookie authentication with session variable
I'm trying to implement asp.net core cookie-based authentication. So I have added the code below to my startup.cs
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
…

anuradha
- 123
- 1
- 9
1
vote
1 answer
What claim in ClaimsPrincipal should I fill to make Roles Authorization work in .Net Core 2.0?
I have this method to sign in a user using .Net Core Cookie Authentication.
[HttpPost]
[AllowAnonymous]
public async Task Login(LoginVM loginModel)
{
var claims = new List
{
new…

Sam
- 4,766
- 11
- 50
- 76
1
vote
1 answer
Set CookieAuthentication redirect path
I only want users with an LocationId to be able to acces my controller methods.
On the location index page the users enter their id, which is saved in a cookie.
If a user tries to acces an page without, the user should be redirecteded to the…

skrl
- 47
- 2
- 6
0
votes
0 answers
Blazor WebAssembly client not automatically handling authentication cookie
I have a Blazor WebAssembly application where I'm authenticating users on the server side using the SignInAsync method and creating a cookie. The authentication process works correctly on the server, and I can see the authentication cookie being set…
0
votes
0 answers
Cookie authentication with IdentityServer 4 on localhost
I've started working on a project which implements a microservice architecture and has a few .NET 6 backend microservices, one of which is an authentication service with IdentityServer 4.
The frontend application is a React app wrapped around a .NET…

wuggs
- 5
- 2
0
votes
1 answer
ASP.NET Core Incorrect Route for LoginPath
I have two controllers in the Controllers folder: HomeController and LoginController.
I am using cookie authentication and set the LoginPath to /Login, expecting it to route to the LoginController.
However, when I click on the login link, the app…

user3552172
- 13
- 3
0
votes
0 answers
How to check if I am authenticated in the client (using JavaScript) against a ASP.NET MVC backend without performing a request?
In my SPA frontend, I want to display a login page if I am not authenticated. In my SPA, everything goes to index.html. So I need to determine if I am authenticated in JavaScript. I am using the ASP.NET cookie authentication scheme. It is set up…

HelloWorld
- 3,381
- 5
- 32
- 58
0
votes
0 answers
Authentication problem with cookie in ASP .NET Core 6
I'm trying to use the authentication cookie for a successful login.
Here it is how I create a cookie authentication
private async Task> CreatingAuthCookie(ApplicationUser user, bool rememberMe)
{
var rolesUser =…

Stephen Programming
- 21
- 3