Questions tagged [asp.net-identity]
The ASP.NET Identity system is designed to replace the previous ASP.NET Membership and Simple Membership systems. Use the ASP.NET Core Identity tag for questions about Identity in ASP.NET Core.
asp.net-identity
9,039 questions
0
votes
0
answers
104
views
Using Identity API from scaffolded pages
We have front end web pages and a back-end API.
We want to add MS's Identity solution.
We added the UI using the scaffolding.
The pages come up nicely.
But to work, they need a connection to the ...
0
votes
1
answer
560
views
What are the benefits of using an external authentication provider for ASP.NET Core Web API?
I'm currently developing a Web API that will be used as the backend for a .NET MAUI Blazor Hybrid application. I'm currently doing research into different authentication methods to secure the API and ...
-1
votes
1
answer
457
views
Role-Authorization for ASP.NET Core Identity methods in ASP.NET Core Web API
I'm in the process of trying to learn both ASP.NET Core Web API and also ASP.NET Core Identity. I've seen that ASP.NET Core Identity has now been integrated into web APIs as part of .NET 8 through ...
0
votes
0
answers
107
views
Do you have to use Identity for authentication in .NET Applications or is it just best practice? (MAUI in particular)
I'm a little confused around the purpose of Identity in .NET and what purpose it serves. Currently to date I have only developed some small internal applications where security isn't much of a concern ...
1
vote
0
answers
68
views
How to have external logins in ASP.NET MVC not need email confirmation, but still keep normal registration need one?
I have an ASP.NET MVC app with identity and I have Google and Facebook external logins which work as intended with email confirmation. But if I have it set to no email confirmation, then it just doesn'...
1
vote
0
answers
418
views
How can I combine ASP.NET Core OAuth2 with Identity?
I am new to ASP.NET Core and I don't understand how to combine OAuth2 and Identity in a way that users can login only with OAuth2 removing Identity's /Account/Login ...
1
vote
1
answer
132
views
How to moq an object with private member fields and setup the methods of those private objects?
I am using .Net Core 8 and I have the following class:
...
0
votes
1
answer
242
views
.NET 8 Identity Microservice using existing user credentials in database
I have a .NET Framework web application that authenticates users and authorizes user roles based on tables that exist in a sql server database instance. i am working on creating a microservices ...
0
votes
0
answers
131
views
ASP.NET Azure Login Infinite Loop
I have a web app built on .NET Framework 4.8 that has integrated login with Azure AD. When I log out and try to log in again, it enters an infinite loop of calls to Microsoft until the access failed ...
0
votes
1
answer
133
views
How to implement [Authorize] in claim-based using .net Identity
I'm working on ASP.NET core web API.
I have implemented the register method and generated the JWT.
In JWT I have only the name that has userId.
...
0
votes
1
answer
114
views
EF Core 8 Identity - Issue with SignInManager / _loginPartial
In my EF Core 8 web app with Identity, my login partial is not working (anymore).
The Identity pages are not loading, nor seem even the corresponding controller actions to be triggered.
I can ...
1
vote
0
answers
992
views
New Blazor Web App, Password Reset "A valid antiforgery token was not provided"
I've created a new Blazor 'Web App' project in .net 8.
I include 'Individual Accounts' when setting up the project.
I've setup email delivery and try a password reset. It sends the reset email first, ...
0
votes
0
answers
100
views
How to send a complex object to a Razor page
I am working on an ASP.NET Core 6.0 Identity project. I want to pass an ApplicationUser object to the LoginWith2fs.cshtml page ...
-1
votes
1
answer
199
views
Tracking the last time a user accessed the site without excessive overhead
I would like to track the last time a user was active on our website.
One approach would be to write middleware that updates the database with every authenticated page request. However, I'm a little ...
0
votes
1
answer
772
views
What are the purposes of the different cookies created by IdentityServer?
I have spent the last week implementing the Duende Software IdentityServer 7 BFF framework integrated with the ASP.NET Core Identity v8 for user persistence and management.
Now this is all up and ...
-1
votes
1
answer
303
views
Blazor (InteractiveServer) + ASP.NET Identity library & GDPR
This question is about what Blazor (IdentityServer) and the ASP.NET Core Identity Library does under the covers with respect to GDPR, CCPA, etc.
First off, if a user is not authenticated by the ...
0
votes
1
answer
198
views
Avoid resetting AccessFailedCount by CheckPasswordSignIn in ASP.Net Identity [closed]
This Is My Program.cs :
...
0
votes
1
answer
152
views
How can a Foreign Key refer to a property on an Entity Splitting child table?
I am creating a new IdentityDbContext based on an existing customized database. Instead of adding custom properties to AspNetUsers, it was decided years ago to add them to another table, CustomUser, ...
0
votes
1
answer
1k
views
.NET 4.8 Owin OpenIdAuthentication: middleware not returning a 302 on full blown pages versus a test page
I am plugging in OpenID authentication to an old .NET Framework 4.8 web app. This is mostly working. As a test I have created a claims.aspx cloned from one of my existing pages, but almost all the ...
0
votes
1
answer
253
views
Allow a user to only see his own data?
Imagine an app where a user can manage some kind of items (his tasks, his book collection or whatever). The user shall only have access to his own items, not those of other users. How would I ensure ...
0
votes
1
answer
51
views
Renaming a column of the AspNetUsers table doesn't work
I am new to Asp.Net Core Identity and EF migration.I have created the Identity related tables in my database using code first approach. The AspNetUsers table has a field named Email. I want to rename ...
0
votes
2
answers
2k
views
Official documentation for JwtBearer middleware/configuration via appsettings.json?
Starting with NET 7, one can configure JWT validation values in appsettings.json, e.g. as mentioned in this blog post (section Simplified configuration for the ...
0
votes
0
answers
196
views
Can't Scaffold Identity in my ASP.NET MVC project
There was an error running the selected code generator:
'Package restore failed. Rolling back package change for Swarojgaar'
This error occurred while trying to scaffold identity in my asp.net mvc ...
0
votes
1
answer
146
views
Issues with Azure AD B2C authentication and accessing protected resources in .NET 8 migration
I am migrating a legacy .NET application to .NET 8, where authentication is being moved from a local identity database to Azure AD B2C. Here, I first check on Azure AD B2C. If the user isn't available,...
0
votes
2
answers
773
views
Authentication Issue User.Identity.IsAuthenticated is False despite successful login
I'm facing an authentication issue in my ASP.NET Core MVC application using Identity and cookies. Despite a successful login using _signInManager.PasswordSignInAsync, User.Identity.IsAuthenticated is ...
1
vote
0
answers
29
views
App redirects to Login Page after every Form Submit operation
I am writing an ASP.NET 8.0 Blazor Server App. I am using Microsoft Identity Framework Core for authorization. It loads menu items after successful user login only. I have used the following ...
0
votes
0
answers
2k
views
ASP.NET Core 6 : AddAccessTokenManagement with Redis cache
I'm working on an ASP.NET Core 6 Web API project which creates several HttpClients to access several external resources using the approach illustrated here.
I'm ...
0
votes
1
answer
147
views
Injecting UserStore and UserManager into Controller throws exception
All I wanted was to move the logic from the razor pages / model into a Controller because it ruins the organization of my project. I have a class that derives from IdentityUser.
This means that I ...
0
votes
0
answers
225
views
How to update the LastLogin field in the AspNetUsers table
I have implemented razor view based identity in asp.net core 6. The logging works fine. However, whenever someone logs in, I want the LastLogin field in the AspNetUsers table to be updated with the ...
3
votes
0
answers
294
views
Migrate from ASP.NET Core Identity to Keycloak
So, I already have a table of users with hashed passwords using ASP.NET Core Identity and want to migrate them to my Keycloak database.
Is there any way of doing this?
1
vote
1
answer
686
views
How to set Login.cshtml as startup page in .NET Identity Framework?
I'm trying to learn .NET Identity Framework. As you know Identity Framework's default pages doesn't need controller actions to work. So I can't view this pages like I did with my custom pages that has ...
2
votes
1
answer
807
views
ASP.NET Core 8 with Google Sign-In StatusCode cannot be set because the response has already started
I'm working on an ASP.NET Core 8 application using Identity for authentication, including Google sign-in. After successfully signing in with Google, the application redirects to /signin-google, but ...
0
votes
2
answers
63
views
What is the WebAPI alternative for AddDefaultIdentity<TUser>()?
When working with .NET identity in web APIs, you don't find AddDefaultIdentity method to add identity to DI service.AddDefaultIdentity is a method found in Web UIs and not in APIs.
What is the ...
1
vote
1
answer
675
views
Rename ASP.NET Core's antiforgery cookie and maintain random part
ASP.NET Core's anti-forgery cookie name is .AspNetCore.Antiforgery.XXX where the last bit is random.
The cookie can be renamed like so:
...
2
votes
1
answer
832
views
How do I configure accessToken lifetime in ASP.NET Core 8 Minimal API using new IdentityApi endpoints?
I've just started working on a new ASP.NET Core 8 Minimal API. I'm trying to play with some new features regarding identity.
I'm using the class below to register auth services.
...
0
votes
1
answer
122
views
Can't save extended User properties in .NET 8 Identity UI (Blazor Server)
I want to extend the Identity User with custom properties, and use the Identity UI to update them. But I can't get data to be saved.
Steps to reproduce the issue, using Visual Studio 17.9.0 Community ...
2
votes
3
answers
7k
views
Identity Framework Web API(.Net 8) how to control the Token Expire time
I have been using Identity Framework packages in my ASP.Net Core Web API Project(.Net8). I have the following setup:
On the Program.cs:
...
0
votes
1
answer
110
views
Auth0 - Unable to see/get login or signup page
I am trying to use Auth0 for the first time and referred sample code from here to create a Asp.net MVC sample application. https://github.com/auth0-samples/auth0-aspnetcore-mvc-samples/tree/master/...
0
votes
1
answer
95
views
External (Google, Microsoft) Login with ASP.NET Identity
When using Duende Identityserver with ASP.NET Identity there are 2 possibilities to add external logins :
via ASP .NET Identity
via Identityserver (AddOpenIdConnect)
What is the difference, what is ...
0
votes
1
answer
1k
views
.NET MAUI - Can I use Authentication WebAPI from existing Blazor project?
We already have a running Blazor WebAssembly App (ASP.NET Core hosted) and implemented Authentication/Authorization according to this tutorial. We added Roles to the project in order to restrict users ...
0
votes
1
answer
249
views
Logging in issues in Razor pages
I have a problem with logging in. Before that, I created a Register page, and it works fine, it inserts the user into the database. I have been using Identity for logging in.
When I try to log in, I ...
3
votes
1
answer
729
views
.NET 8 Blazor Interactive WebAssembly HttpClient and Identity issues
This is how I created the project
So far I have:
Added Roles to the project, and they are working on FE and BE, e.g. I have added a specific user to a role, and content is rendered on the FE if the ...
1
vote
1
answer
334
views
How can I reuse AuthorizationHandler logic for different AuthorizationRequirements?
I am trying to find a way to imperatively authorize resources in an asp.net razor pages application. So far, I have followed the guide found in this link: https://learn.microsoft.com/en-us/aspnet/core/...
1
vote
0
answers
753
views
Adding multiple OpenIdConnect authentication schemes to the services and choosing at runtime which to use
I have a Asp.net core mvc project that uses the OpenIdConnect authentication scheme with the Microsoft Identity platform. The way I add it is in my Startup class in ConfigureServices method like so:
<...
-3
votes
1
answer
385
views
How to use username to register and login in ASP.NET Core
I am working on an ASP.NET Core project with identity. In the default Register.cshtml page, there is a textbox to enter the email and confirm email.
Similarly in ...
0
votes
1
answer
171
views
class with No Name(Empty name) is added in Area/Identity/Data folder ,when add identity using scaffolding identity in project using .net 8.0 and VS22?
I am created a new .Net core web application using vs 2022 and .NET 8.0 Framework. Project created successfully but when i try to add Asp.net core identity using scaffolding identity. I add dbcontext ...
0
votes
1
answer
171
views
Use IdentityApiEndpoints and Razor pages DefaultIdentity UI together
How can I have both identity endpoints and Razor pages identity UI in the same project?
I tried this code in Program.cs but app crash with an error.
...
0
votes
0
answers
36
views
VB.NET VS2017 net 4.6.1 moving AspNetIdentity 2.2.2 code from website project to reusable DLL since I have 80+ web sites to convert
Using package Microsoft.AspNet.Identity.Core.2.2.2\lib\net45\Microsoft.AspNet.Identity.Core.dll
The following IntranetSecurity.vb code works when called within the website code base.
...
0
votes
2
answers
129
views
InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.SignInManager`1[Areas.Identity.Data...]'
I am getting the following error when I am trying to load my Identity login page -
InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Identity.SignInManager`1[FNSD....
0
votes
1
answer
130
views
EF Core generate b-tree but not a btree in postgres
EF Core 8.0.1 generate b-tree SQL code for Postgres. When I'm trying to apply migration on a server, it produces a Postgres error
...