Questions tagged [identity]

0

votes
0

answer
8

Views

IdentityServer4 with AspNetIdentity - How to manage users

I have integrated AspNetIdentity into IdentityServer4 for user management. Previously I was using Auth0 and I had an admin page in my web application to change user claims which in turn called the management API for Auth0 to change user claim values. With IdentityServer4, as I integrated Identity fo...
Help123
1

votes
0

answer
98

Views

Obtaining Access Tokens From External Login

I'm modify my authentication from using Identity server to use the built in .net-core authentication. I'm trying to obtain the Access Tokens From An external Login. But when I go to obtain the User from the User Manager it returns null. I'm using the OAuth Authorization Code flow to login. I hav...
johnny 5
1

votes
0

answer
130

Views

Why is the identityProvider claim missing in the ClaimsPrincipal running in an Azure Function v2?

I have an Azure Function App that is deployed in 2 environments, one for Development and one Production, each with their own URL. In both environments, the functions are configured to enable users to authenticate using their Facebook account. I actually configured 2 different Facebook applications:...
Kzrystof
2

votes
0

answer
8

Views

How to use roles in .NET MVC Core

I have tried for days now to implement roles in a MVC project. I have started a new project and chosen Authentication to 'Individual user account'. I added the [Authorize] to HomeControllers Indexpage and everything works. To add a role i included: services.AddDefaultIdentity().AddRoles().AddEntityF...
Karelin
0

votes
1

answer
29

Views

Refresh expired token web api

The code below works fine at generating new tokens from a valid token but not an expired one. [HttpPost] [Route('refreshtoken')] public async Task RefreshToken() { var identity = User.Identity as ClaimsIdentity; var username = identity.FindFirst('user'); if (username.Value != null) { var user = awai...
theJ
1

votes
1

answer
756

Views

Is there anything wrong with my method for calling NHibernate in async?

I am trying to implement Identity's IUserStore with NHibernate, which lacks the async methods required by IUserStore. This is my ignorant attempt at dispatching the blocking call and making the method async: public class QsaasUserStore : IUserStore where TLogin : QsaasUserLogin { public Task CreateA...
ProfK
1

votes
1

answer
892

Views

Create custom role handling in ASP.NET 5 Identity 3.0 (without EF)

I have successfully created a simple MVC 6 application which uses my own ApplicationUser, an ApplicationUserStore (implementing IUserStore and IUserPasswordStore) and ApplicationUserManager (extending UserManager). The login does now work perfectly. Now I do want to extend my project to support anno...
marco birchler
1

votes
1

answer
224

Views

Trouble migrating to Asp.Net Identity/OWIN

We have our own db already, with users, roles,userrole tables already in place, and just have discovered the Identity system in .net. I would like to integrate the application cookie authentication but having trouble understanding the different concepts in this Identity model. The OWIN adapter that...
RealWorldCoder
1

votes
2

answer
487

Views

AddScoped service is not retaining settings throughout the request

I have created an Interface public interface ICurrentUser { Task Set(UserAuth user); User Get(); } and a class public class CurrentUserSvc : Interface.ICurrentUser { private User _u; private UserAuth _ua; private AppDbContext db; public CurrentUserSvc(AppDbContext db) { this.db = db; } public User...
Alex C
1

votes
2

answer
3k

Views

ASP.NET Identity 3.0 - how is the database with user tables created in an MVC application?

I am trying to build a simple login system from the ground up, using the code-first approach with ASP.NET MVC v5, Entity Framework v7, and Identity v3. I'm modeling my app after the ASP.NET MVC app with individual user logins template that Visual Studio comes with. All I want is for the user to crea...
jmk22
1

votes
1

answer
399

Views

Simple Injector - AddIdentity equivalent

I am using Simple Injector in an ASP.NET 5 app, and need to switch over my Identity registrations from the built in Microsoft DI. Currently, it looks like this; services.AddIdentity(o => { o.Password.RequiredLength = 6; o.Password.RequireNonLetterOrDigit = false; o.Password.RequireDigit = true; o.Pa...
Ciel
1

votes
1

answer
803

Views

Naming cookies in ASP.NET 5

In my ASP.NET 5 MVC 6 app, I'm using ONLY the cookie middleware without ASP.NET Identity -- as described in this document: https://docs.asp.net/en/latest/security/authentication/cookie.html I'm also using social authentication i.e. Facebook, Google, etc. So the user authenticates through the social...
Sam
1

votes
1

answer
2.9k

Views

Create users and roles in SQL Script with ASP.NET Identity

We have used Membership earlier and now in the new project we are using Identity for authentication and authorization. We are able to create users and role programmatically (in Seed method of Identity project). We also need to link these membership user to application user e.g Employee while creatin...
SBirthare
1

votes
3

answer
205

Views

ASP.NET Identity - extending the _LoginPartial

I'm finding this difficult to summarise, hence the poor question name. On my .net web application, which is using Identity, there is a login partial that was auto generated that displays the users 'username' property like so: @Html.ActionLink(User.Identity.GetUserName(), 'Index', 'Manage', routeValu...
Luke Stoward
1

votes
1

answer
58

Views

Get users by user role and subsidiary ID

In ASP.NET Identity we have following tables AspNetUsers AspNetRoles AspNetUserRoles Additionally I added the following column to the AspNetUsers table Subsidiary_ID Now I want to load a list with following filters RoleName == 'Approver' Subsidiary_ID == '04' So for that purpose I'm trying to write...
kez
1

votes
2

answer
664

Views

PasswordSignInAsync. ArgumentNullException: Value cannot be null

I'm using the following code to sign in a user: public async Task PasswordSignInAsync(string userName, string password, bool isPersistent, bool lockoutOnFailure) { var signInResult = await _signInManager.PasswordSignInAsync(userName, password, isPersistent, lockoutOnFailure); return GetResponseBySig...
Rhys
1

votes
2

answer
615

Views

ASP.net Identity 2 sign in continue to use old password after changing password

I am using the Change Password functionality that visual studio generated for the accountcontroller. I am able to change the password without errors but when I go to login using the new password, I get a login error but if I use the old password, it works. If I restart the app then the newly change...
Chirdeep Tomar
1

votes
1

answer
45

Views

Identity without individual user accounts in ASP.NET

I am developing an ASP.NET 5 web application which allows users to play chess anonymously (without creating an account) against each other. I need to maintain the state for the individual user during the game, what is the best way to achieve this? Is there a way to configure ASP.NET Identity for the...
koryakinp
1

votes
1

answer
898

Views

Register UserManager with Autofac in ASP.NET Core

I've just noticed that UserManager changed since MVC5. My question is: how to register UserManager in Autofac in ASP.NET Core ?
GooRiOn
1

votes
1

answer
76

Views

New IDENTITY column on existing table - what will be the order?

I added an IDENTITY column to an existing table in SQL Server 2012. Expected the numbers to be generated in the order of clustered index (non-sequential GUID), but to my surprise they got generated in the order of one of the indexes which is not even unique, and also coincidentally exactly the order...
Andrew
1

votes
1

answer
515

Views

Custom ASPNET Identity one to many relationship using multiple context application

Basically, I want to have a user that can create their own stories. I have these classes: public class ApplicationUser : IdentityUser { public string DisplayedName { get; set; } } public class Story { public int Id { get; set; } public string Content { get; set; } } They are managed on a different c...
Boy Pasmo
1

votes
1

answer
60

Views

Unable to sign-in because of Microsoft.AspNet.Identity.Application error

Just trying to get simple authentication working, but receive exception when trying to login: Seeded the DB with: user = new ApplicationUser { FirstName = 'John', LastName = 'Smith', UserName = 'jsmith', Email = '[email protected]', EmailConfirmed = true, LockoutEnabled = false }; var result = await...
O.O
1

votes
1

answer
111

Views

MVC5 Customising Identity User

I'm trying to add a few properties into my registerviewmodel so that when a user registers on my site they'll need to add their LastName,FirstMidName,DepotID and DepartmentID. I'm getting the errors when I try to modify my RegisterViewModel Create Method. RegisterViewModel Register method error for...
TykiMikk
0

votes
0

answer
31

Views

The INSERT statement conflicted with the FOREIGN KEY with user Id (ASP Identity)

I'm working on a feature that allows a user to submit a post via a form, it successfully obtains the user Id from AspNetUsers. I have implemented a radio button that gives a user the option to become an anonymous submission. The code is as follows, protected void AddPost(object sender, EventArgs e)...
zadders
1

votes
1

answer
1.1k

Views

how to Implement ASP.Net Identity Authentication in WCF to be used in an MVC project

I have looked in many places and there are some samples codes here and there pertaining to WIF and WCF, consuming WCF services in an MVC project (that I can do easily) but there do not seem to be anything specific towards taking the AccountController.cs functionality that comes out of the box in an...
H.Flores
1

votes
1

answer
299

Views

How to change table names in Asp.net Identity 3.0?

How to change table names in ASP.net Identity 3.0? I have searched but I didn't get any workable write up for Identity 3.0 and this How can I change the table names used by asp.net identity 3 (vnext)? is not working.
1

votes
2

answer
228

Views

mock GetClaimsPrincipal().Identity

I am not able to find the mock the below lines of code. ClaimsPrincipalFactory userClaimsPrincipal = new UserClaimsPrincipalFactory(); System.Security.Claims.ClaimsIdentity claimIdentity = userClaimsPrincipal.GetClaimsPrincipal().Identity as System.Security.Claims.ClaimsIdentity; When I try to mock,...
shankar.siva
1

votes
1

answer
727

Views

Seeding user with int ids fails in Asp.net core MVC6

I am using Identity 3. I want to seed an admin user on startup. I have converted the string ids to 'int' ids using as an example SwiftCourier on github. Identity 3 is different in some aspects and this applies to the setting of 'int' for ids as shown in the SwiftCourier example as compared to Ident...
si2030
1

votes
1

answer
309

Views

How to switch turn DatabaseGeneratedOption.Identity on/off at runtime

I have a DB that created by EF6 Code First. Some tables have an identity column. I need to insert some records to these tables with OLD Id values. I tried the solution that appeared in this link How to switch between DatabaseGeneratedOption.Identity... that demonstrates how to switch between compute...
Efi_K
1

votes
1

answer
107

Views

AspNet Identity ApplicationUser with subtype-specific fields

I have a ASP.NET MVC application which uses ASP.NET Identity. I have 3 roles for my application: Student Author Admin Those 3 profiles have various fields to persist, so Student role could have X number of fields, Author role, Y number of fields and Admin role, Z number of fields, all unrelated to e...
gdyrrahitis
1

votes
1

answer
591

Views

Configure User Registration with IdentityServer3?

I am very new to Authentication and Authorization. So I have some questions ask from the community.This is what have I done so far.I search on how to do Authentication and Authorization I see the IdentityServer3 and I configure with my project. In my project I have separate DB to IDServer and One to...
NoughT
1

votes
2

answer
164

Views

How to get a subset of Users from ASP.NET Identity 2

Using a slightly modified version of the default ASP.NET MVC 5 template (with Individual Accounts), I am trying to get a subset of users based on an intermediary table. I have already built up an administration UI that can return a list of all users, but now I need to limit the set of users returned...
Bill Kron
1

votes
1

answer
188

Views

Session timeout increases tremendously when the user picks to stay in the system by clicking a button (asp.net mvc 5.0 using OWIN)

I am trying to implement session timeout popup. I have made a fair progress. Everything seems to work fine except when the user clicks the 'Stay in the system' button in the popup window. What this button does is to make an ajax call to the following Action in the Account Controller: public async Ta...
renakre
1

votes
1

answer
449

Views

OIM Custom ICF based connector throwing runtime exception

I have created one ICF based Flat file connector which uses REST web service to Read/write the data from file. I have used jersey implementation 1.6 to write the web service and the java client which will call that web service. I am using stand alone java code for testing the CRUD functionality.It's...
varpekv
1

votes
1

answer
88

Views

ServiceStack Identity on field other than PK - Insert fails

When I try to use the 'Insert' function in ServiceStack (against SQL Server 2014) using an object from the below class, it tries to insert a 0 (default of the ContactId property) for the ContactId instead of auto generating one in the database. ContactId is IDENTITY NOT NULL. ContactId is the cluste...
Chris Klepeis
1

votes
2

answer
616

Views

Asp net Identity, calling AccountController from HomeController and trouble with UserMenager

So I have successfully implemented Account controller and various methods that come with it. I have one specific method that returns AppUser (current user) public AppUser GetCurrentUser(){ AppUser user = UserMenager.FindById(User.Identity.GetUserId()); return user; }. Now I don't want to have insta...
nhrnjic6
1

votes
1

answer
635

Views

Get all user for role or all roles for user

I am using Identity 2 and EF 6 and I would like to get a list of role objects for a user id or a list of user object for a roleId. IEnumerable GetUserRoles(string userId) where TRole : class, IRole IEnumerable GetRoleUsers(string roleId) where TUser : class, IUser Entity framework does not appear to...
Ablue
1

votes
1

answer
592

Views

Auth.GoogleSignInApi as GoogleAuthUtil replacement for google plus sign in

My goal is to log into a BaaS with the Google plus sdk, the BaaS requires a tokenId via googleSignInAccount.getIdToken() and an accessToken. GoogleAuthUtil.getToken(activity, accountName, scopes); is depreciated, and was used to get the accessToken. GoogleAuthUtil.invalidateToken(activity, token); i...
ersin-ertan
1

votes
2

answer
295

Views

Why Log out after verify phone number in asp.net identity?

I am using asp.net Identity in my project. In VerifyPhoneNumber view, when user confirm his phone number, he is logged out (.AspNetApplicationCookie is removed. I checked this from Resource tab inspect chrome). Code of VerifyPhoneNumber action in ManageController: if (!ModelState.IsValid) { return...
Majid Basirati
1

votes
2

answer
796

Views

Is it possible to save a role with enum parameter using Identity?

I am experimenting with creating a authorization with identity. So far eveything is working with the guidlines I have found online. However I want to modify the saving of roles. I have created an enum and I save this enum to aspNetRoles table (code will follow below). The way a role is saved to a...
ThunD3eR

View additional questions