Questions tagged [identity]

An inherent property of an entity that distinguishes that entity from all others. Frequently used to refer to user identity and authentication.

Identity typically refers to user identity in authentication scenarios.

2969 questions
48
votes
1 answer

Why does '() is ()' return True when '[] is []' and '{} is {}' return False?

From what I've been aware of, using [], {} or () to instantiate objects returns a new instance of list, dict or tuple respectively; a new instance object with a new identity. This was pretty clear to me until I actually tested it and I noticed that…
Dimitris Fasarakis Hilliard
  • 150,925
  • 31
  • 268
  • 253
47
votes
11 answers

Database-wide unique-yet-simple identifiers in SQL Server

First, I'm aware of this question, and the suggestion (using GUID) doesn't apply in my situation. I want simple UIDs so that my users can easily communicate this information over the phone : Hello, I've got a problem with order 1584 as opposed…
Brann
  • 31,689
  • 32
  • 113
  • 162
46
votes
8 answers

User.Identity.GetUserId() returns null after successful login

I've defined a temp variable to get current user id, it always returns null. Here is the snapshot: Why? UPDATE: // // POST: /Account/Login [HttpPost] [AllowAnonymous] public async Task Login(LoginViewModel model,…
Tân
  • 1
  • 15
  • 56
  • 102
46
votes
4 answers

Convert a username to a SID string in C#/.NET

There's a question about converting from a SID to an account name; there isn't one for the other way around. How do you convert a username to a SID string, for example, to find out which HKEY_USERS subkey relates to a user of a given name?
crb
  • 8,132
  • 6
  • 37
  • 48
45
votes
5 answers

Getting new IDs after insert

I'm inserting a bunch of new rows into a table which is defined as follows: CREATE TABLE [sometable]( [id] [int] IDENTITY(1,1) NOT NULL, [someval] sometype NOT NULL ) using the following insert: insert into sometable select somefield as…
spender
  • 117,338
  • 33
  • 229
  • 351
45
votes
7 answers

Primary key from inserted row jdbc?

Is there a cross database platform way to get the primary key of the record you have just inserted? I noted that this answer says that you can get it by Calling SELECT LAST_INSERT_ID() and I think that you can call SELECT @@IDENTITY AS 'Identity';…
Omar Kooheji
  • 54,530
  • 68
  • 182
  • 238
44
votes
2 answers

The `is` operator behaves unexpectedly with non-cached integers

When playing around with the Python interpreter, I stumbled upon this conflicting case regarding the is operator: If the evaluation takes place in the function it returns True, if it is done outside it returns False. >>> def func(): ... a =…
Dimitris Fasarakis Hilliard
  • 150,925
  • 31
  • 268
  • 253
43
votes
1 answer

What is the difference between "a is b" and "id(a) == id(b)" in Python?

The id() inbuilt function gives... an integer (or long integer) which is guaranteed to be unique and constant for this object during its lifetime. The is operator, instead, gives... object identity So why is it possible to have two objects that…
badp
  • 11,409
  • 3
  • 61
  • 89
42
votes
11 answers

How can I change default ASP.NET Identity table names in .NET CORE?

I've started with .NET Core, in MVC 5 I changed default table names for example: AspNETUsers to Users in this way and it worked perfectly: In IdentityModels Class I dded: protected override void OnModelCreating(System.Data.Entity.DbModelBuilder…
Archil Labadze
  • 4,049
  • 4
  • 25
  • 42
42
votes
7 answers

MVC5 (VS2012) Identity CreateIdentityAsync - Value cannot be null

I am trying to setup OAuth for a an MVC5 site (in VS2012). I am using Fluent NHibernate. I have setup my own Userstore and pass in a repository object to access NHibernate session object. I pass my store into the default aspnet usermanager…
Jon
  • 15,110
  • 28
  • 92
  • 132
42
votes
8 answers

Writing Unit Test for methods that use User.Identity.Name in ASP.NET Web API

I am writing test cases using the Unit Test for ASP.NET Web API. Now I have an action which makes a call to some method I have defined in the service layer, where I have used the following line of code. string username = User.Identity.Name; // do…
Yasser Shaikh
  • 46,934
  • 46
  • 204
  • 281
40
votes
6 answers

Handling identity columns in an "Insert Into TABLE Values()" statement?

In SQL Server 2000 or above is there anyway to handle an auto generated primary key (identity) column when using a statement like the following? Insert Into TableName Values(?, ?, ?) My goal is to NOT use the column names at all.
James McMahon
  • 48,506
  • 64
  • 207
  • 283
40
votes
5 answers

Set "in" operator: uses equality or identity?

class A(object): def __cmp__(self): print '__cmp__' return object.__cmp__(self) def __eq__(self, rhs): print '__eq__' return True a1 = A() a2 = A() print a1 in set([a1]) print a1 in set([a2]) Why does first…
Gennadiy Rozental
  • 1,905
  • 2
  • 13
  • 17
40
votes
3 answers

What's the purpose of `id` function in the FSharp.Core?

From Operators.id<'T> Function (F#): The identity function. Parameters: x Type: 'T (The input value) Return Value: The same value F# Core Library Versions, supported in: 2.0, 4.0, Portable Why is there a function that returns its input?
MiP
  • 5,846
  • 3
  • 26
  • 41
40
votes
4 answers

Does Java guarantee that Object.getClass() == Object.getClass()?

I really do mean identity-equality here. For example, will the following always print true? System.out.println("foo".getClass() == "fum".getClass());
Mackenzie
  • 1,897
  • 1
  • 19
  • 25