Questions tagged [asp.net-identity-3]

1

votes
2

answer
58

Views

Why does OAuth fail when using ASP.NET Identity Core?

I have an ASP.NET Core 2.x project with the following configuration: services .AddAuthentication(options => options.DefaultScheme = CookieAuthenticaitonDefaults.AuthenticationScheme) .AddCookie(CookieAuthenticationDefaults.AuthenticationScheme) .AddFacebook(ConfigureFacebook); Predictably, when I ca...
Jesse Hallam
1

votes
2

answer
179

Views

Does submit button passes its value to action method, on form submit?

Update: What are the control/fields whose value would be submitted when the form is post back? In an ASP.NET MVC Form, if user double clicks on the submit button, the form would be submitted two times. In order to solve this problem I implemented the solution explained here. This is my solution, wh...
Hooman Bahreini
0

votes
0

answer
18

Views

How to integrate Social Login with existing .Net core Web API backend and Angular SPA frontend with working OpenIddict user/password and bearer token

TL;DR Question: how to implement social login (OAuth2 authorization flow) with an existing SPA/Web API application that is based on identity, user/password, bearer token authentication? I have an existing application that has: Backend: .Net Core 2 Web API with Identity and OpenIddict services config...
Fernando Ribeiro
0

votes
0

answer
5

Views

Mistake with my code same id but multiple in 2nd table how to get each separate

So I have a user that can create multiple time sheets at a time each if a user creates a timesheet and creates more than 1 project at 1 time it will create separate timesheetdetails for each project but they will all have the same timesheetmaster. How can I specifically pick each timesheetdetail whe...
Bigbear
0

votes
0

answer
15

Views

Need to display certain values stored in the AspNetUser table

I'm using the code below to see if I can display the values of Description, Quantity, Price and Value stored in the AspNetUser table as can be seen. My first attempt in the 2nd 'IF' does not yield that apart from the userid. I went ahead to add the last three lines but the 'string' in the last line...
Ugochukwu Unamka
1

votes
1

answer
223

Views

Where does ASP.NET Identity store information about external authentication provider?

In my ASP.NET MVC application, I have enabled authentication using Microsoft and Google accounts. They both are working fine. i.e., I am able to login to my application using my hotmail and gmail both accounts. Once logged in (say, using Microsoft account), I am able to see following screen as well...
Nirman
1

votes
1

answer
507

Views

Combine ASP.NET MVC and Web API projects using identity

I am new to ASP.NET and I have to create an ASP.NET MVC project using the identity framework for authentication and authorization, but the access to the database (SQL Server) must be done in an independent web service project so I created a Web API project with also identity containing all services...
sam
1

votes
0

answer
171

Views

How to quickly sign out all the users in an ASP.NET MVC application via Identity?

While the answer here is fine for one or a couple of users: ASP.net Identity 2.0 Sign-out another user it does not really scale, it can take a lot of time: https://msdn.microsoft.com/en-us/library/dn497517(v=vs.108).aspx I am thinking about SignalR forcing a refresh on the client and making a tempor...
Ehouarn Perret
1

votes
1

answer
861

Views

Database connection not created in IdentityDbContext

I'm trying to authentication Asp.Net Core 2 Web API with Asp.Net Identity 2. Here's my code for the AuthController and the databasecontext: public AuthController(UserManager userManager, SignInManager signInManager, RoleManager roleManager , IPasswordHasher passwordHasher, IConfiguration configurati...
devC
1

votes
1

answer
600

Views

How Create Guid-string for id column in c#

When I was looking at the asp.net Identity 2 sample, I found an interesting point. The point here is that using the Guid in the id column.when i to table definition (example: AspNetRoles table) I saw the command below: CREATE TABLE [dbo].[AspNetRoles] ( [Id] NVARCHAR (128) NOT NULL, [Name] NVARCH...
arman
1

votes
1

answer
220

Views

Issue bearer token from IdentityServer4

Is it possible to generate manually bearer token and return it if user is logged in successfully? Here's my point of view: [HttpPost] [AllowAnonymous] [ValidateAntiForgeryToken] public async Task Login2(LoginViewModel model) { if (ModelState.IsValid) { var result = await _signInManager.PasswordSignI...
Cieja
1

votes
0

answer
168

Views

Expose ASP.NET Identity via LDAP interface (.NET Core 2.0)

I have an ASP.NET Core 2.0 application where I am using the stock implementation of ASP.NET Identity to manage and authenticate my users. I would like to use my application as an identity provider for 3rd party service that I am planning on using. The only issue is that this service can only communi...
1

votes
1

answer
222

Views

ASP.net core identity 2.0: proper way to use claims identity with db lookup?

I'm new to the concept of claims-based identity so if the question is unclear, please let me know. I've got a derived user collection, and it relates to an 'organizations' collection. A user can be an admin in related organizations. I'm trying to build the ability to have an [IsAdminForThisOrg] attr...
BenjiFB
1

votes
0

answer
53

Views

Asp.Net Identity Doesn't Remember Logged User

I've an ASP.MVC application with Asp.Net Identity. I want to keep logged user's session for one year. I set cookie expire to for one year but the application ask user name and password after a few days. I don't want the application ask login information again. What can i do? app.UseCookieAuthentica...
Yargicx
1

votes
0

answer
162

Views

ASP.net Identity management with Azure, in Web Form

I have a Webform ASP.net (in VB.net) that I want to add identity management too. I have added code that allows for the registration of users. But, I am stuck on how to log a user in. My application uses SSO with Azure Active Directory. What I would like to do is, after the user Authenticates wit...
jason
1

votes
0

answer
261

Views

Anti Forgery cookie issue after signout from IdentityServer4

I am developing a solution with IdentityServer4 and ASP.NET Core 2.0.5. After logging out using HttpContext.SignOutAsync, the user can go on the login form again and try to login. However, the error message I get after form post in the console is: The antiforgery cookie token and request token do no...
Gorgi Rankovski
1

votes
1

answer
790

Views

Role authorization in .net core 2.0 using Identity

I am using .net core 2.0 and trying to do authorization using asp identity in a mvc website. (Authentication is done using Google OAuth). Authentication is working fine i.e users can access controllers/views after logging in through google. But when I try adding a role('Admin') to a particular contr...
vicky99
1

votes
0

answer
181

Views

UserManagerExtensions methods changing System.Security.Principal.WindowsIdentity

we are using Identity 2 with MVC 5 for our web project. Requirement is to be able configure impersonated user for web application in web.config like so We implemented custom UserManager and configured authentication like this: public partial class Startup { public void ConfigureAuth(IAppBuilder app)...
Peter Kavecansky
1

votes
1

answer
159

Views

Using 2FA for password reset

My application uses Asp.Net Identity and sends a Two Factor code to my Auth app on login. This is pretty standard (as there lots of examples on the net) and uses the SendCode() method. My understanding is that the 'magic' is done by this line: // Generate the token and send it if (!await SignInMan...
Shak
1

votes
1

answer
58

Views

How to check user roles in View MVC5

As the question says, I am trying to check for a user object's roles in MVC5 View. Basically what my view does is a listing of all the registered users and their current role. Here's my view: @model IEnumerable @{ ViewBag.Title = 'Talent Center Institute: Usuarios'; ViewBag.Menu = 'Usuarios'; ViewB...
l_degaray
1

votes
1

answer
121

Views

SharpArch.Domain.PreconditionException: 'An ISessionStorage has not been configured'

I tried to build ASP.NET Identity project with hibernate SharpArch.Domain.PreconditionException: 'An ISessionStorage has not been configured' https://github.com/Streamc/IdHiber I borrow code from https://github.com/nhibernate/NHibernate.AspNet.Identity/tree/master/source/NHibernate.AspNet.Web proje...
ifooi
1

votes
0

answer
669

Views

ASP .NET Identity - How To Validate Auth Token In Custom Filter Attribute

I have a question about verifying an Auth Token. Currently, I'm generating my Auth Token at /token and sending it back to the client side where I store it in session storage. To make the process as secure as possible I'm looking to store the token in a HttpOnly and Secure cookie to protect against...
DevEng
1

votes
2

answer
648

Views

soft delete in asp.net identity

I'm new to asp.net. How to store the value of IsDeleted to database? [HttpPost, ActionName('Delete')] [ValidateAntiForgeryToken] public async Task DeleteConfirmed(string id) { if (ModelState.IsValid) { var user = await UserManager.FindByIdAsync(id); //set IsDeleted to true user.DeleteUser();...
Ahmed
1

votes
1

answer
195

Views

SignInStatus always returns Success on TwoFactorAuthentication is enabled in webapi using asp.net identity

I am implementing 2 factor authentication in WebApi, asp.net identity and OWIN. Every time I log in, I get SignInStatus = Success never reaches to SignInStatus = RequiresVerification though user TwoFactorAuthentication is enabled. Below are some code snippets, Startup.cs: private void ConfigureAuth...
shailesh
1

votes
0

answer
64

Views

ASP.NET Identity not being able to login

I am working to give an admin the option of adding new users to my website, using ASP.NET Identity. My idea is that I have a link in my layout that redirects me to the account/register view if (User.IsInRole(RoleName.IsAdmin)) { //this is just for the admin //other links @Html.ActionLink('Add assist...
jdodle
1

votes
0

answer
365

Views

password History for Identity Core

is there any default implementation for password history? i'm trying to implement that feature on my project with identity so i have added password history table which contain password hashes. when user change password usermanager generate hash for password. var passwordHash = _userManager.PasswordH...
Gayan
1

votes
0

answer
131

Views

Multi Tenant authentication middleware

Im looking for the best approach for supporting multi-tenancy when your identity server has a URL per tenant. This is a problem for me because im using the aspnet/security middleware and you obviously need to set the token endpoint etc at startup. Im effectively looking to resolve the host at runtim...
Christo
1

votes
0

answer
184

Views

Retrive randomly generated session id coockie name asp.net

I want to change asp.net ASP.NET_SessionId cookie name with some randomly generated string and also hash it's value. I've done both, But the problem is that i don't know how to get the `ASP.NET_SessionId and check if the hashed value is valid or not. The purpose is to prevent session hijacking. app....
Hadi Mohammadi
1

votes
0

answer
34

Views

ASP Identity: Eager loading for User

I have added a propertry to IdentityUser named ClientID that related properly to table Clients by FK. Now i want to retrive user with his client name (from Clients table). How do i create Include function for that in context.Users? public ActionResult Users(string filter = 'all') { context = new Ide...
shdr
1

votes
0

answer
193

Views

Do you need asp.net identity for windows based intranet AD role authorization?

I am building an MVC 5 intranet app that would authenticate via Windows check if a user is in a certain Active Directory group then assign those privileges accordingly depending on what group they are in. In the past, I have simply got the user and checked if they are in a specified AD group then as...
Pod
1

votes
1

answer
315

Views

Hybrid auth flow in .NET Core WebApi project with SPA

I'm working on a project, and it's my first encounter with an SPA with API architecture (as well as my first .NET Core project). I'm trying to figure out how the authentication/authorization flow should work, as it's sort of complicated. The identities will be provided by on-prem ADFS via OAuth....
lmerry213
1

votes
0

answer
230

Views

Asp.Net Identity with Entity Framework 6

In my solution I am using ef6 for persistence library targeting the full .NET framework For web API => ASPNetCore targeting the full .NET framework Now when it comes to use aspnetcore identity, it's dependent on EFCore 2.0 and VS is not able to make migration when it comes to have EF6 and EFCore to...
Jamal Al-Madani
1

votes
1

answer
45

Views

ASP.NET Identity 2 initializer drop all my tables

I'm using asp.net identity, 2.21 version. As soon as my AppDbInitializer is triggered in Global.asax, all tables in LibraryContext are deleted. So I get SqlException: Invalid object name 'dbo.Books' error. I think, the problem is in my initializers, but don't know where. All tables use the same 'De...
Vlad
1

votes
0

answer
606

Views

Database first with Identity in .NET Core and Entity Framework Core

I would like to use a Database First approach to managing my database with EF Core, and not just for the initial database creation. I'm using this command to generate my entity models and mapping code: Scaffold-DbContext 'Server=(localdb)\mssqllocaldb;Database=MyDB;Trusted_Connection=True;' Microsof...
Hazza
1

votes
1

answer
27

Views

get user from cookie and sign that user in mvc Identity

I have an Asp MVc web project. In order to sell product, the user should register or login to my website. After choosing its product, the user will redirect to bank gateway through PaymentAction method: public String PaymentAction( TransAction Model ) { try { Payment ob = new Payment(); Model.amount...
Xeta7
1

votes
1

answer
51

Views

User is null in ASP Core 2 controller

I have been attempting to get the current logged in users ID in a ASP Core 2 project in VS 2017. I am using the default template with individual user accounts. I've looked at a lot of resources but still cant figure out why the User Claim always returns null. I can access User info only from the Acc...
el_M
1

votes
1

answer
53

Views

Central login Site for multiple ASP .Net Web Applications

I'm building several App's or Modules (Each got its own Project or might be a solution) and I need to develop a central core module that acts as a configuration App as well as the main login portal and users management (Using the built-in Identity 2.0) I need a hint or a road map on how I can allow...
Yasser Akram
1

votes
1

answer
44

Views

ASP Identity Issue not authenticting

So I'm using ASP Identity. I customized the profile with adding isEnabled so that I know if a user is Active or not. This works fine and the database is updated without issue. So after research, I saw that I need to override 'public async override Task PasswordSignInAsync' that I can check for t...
Ronkingjr
1

votes
0

answer
80

Views

ASP.NET Identity - RedirectLocation is null inside Application_EndRequest

I created a brand new ASP.NET MVC project with Identity Authentication. The autogenerated Startup.Auth.cs has the following code: public void ConfigureAuth(IAppBuilder app) { app.CreatePerOwinContext(ApplicationDbContext.Create); app.CreatePerOwinContext(ApplicationUserManager.Create); app.CreatePer...
Alisson
1

votes
1

answer
53

Views

Why is getting roles when getting a list of users so slow?

I'm getting all users in the DB and their associated roles. It works, but man is it slow. var ctx = new SiteUserContext(); var ctxUserList = ctx.Users.ToList(); //var userManager = new UserManager(new UserStore(new SiteUserContext())); var jsonModels = from user in ctxUserList select new { userName...
cphilpot

View additional questions