IdentityServer3.EntityFramework | EntityFramework persistence layer | Identity Management library
kandi X-RAY | IdentityServer3.EntityFramework Summary
kandi X-RAY | IdentityServer3.EntityFramework Summary
Dev build: ![Gitter] Chat.svg). IdentityServer3.EntityFramework is a persistence layer for IdentityServer v3 configuration data that uses EntityFramework as it's database abstraction.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of IdentityServer3.EntityFramework
IdentityServer3.EntityFramework Key Features
IdentityServer3.EntityFramework Examples and Code Snippets
Community Discussions
Trending Discussions on IdentityServer3.EntityFramework
QUESTION
I hope this is something simple and easy to solve. I have installed IdentityServer3 in an existing project and managed to get the "in memory" stuff working. Now I am hooking up to my UserManager. When I try to authenticate, I get this error:
"One or more validation errors were detected during model generation:\r\n\r\nCormar.Sql.Claim: : EntityType 'Claim' has no key defined. Define the key for this EntityType.\r\nCormar.Sql.ClaimsIdentity: : EntityType 'ClaimsIdentity' has no key defined. Define the key for this EntityType.\r\nCormar.Sql.IdentityReference: : EntityType 'IdentityReference' has no key defined. Define the key for this EntityType.\r\nCormar.Sql.Secret: : EntityType 'Secret' has no key defined. Define the key for this EntityType.\r\nCormar.Sql.RefreshToken: : EntityType 'RefreshToken' has no key defined. Define the key for this EntityType.\r\nCormar.Sql.Token: : EntityType 'Token' has no key defined. Define the key for this EntityType.\r\nCormar.Sql.Scope: : EntityType 'Scope' has no key defined. Define the key for this EntityType.\r\nCormar.Sql.ScopeClaim: : EntityType 'ScopeClaim' has no key defined. Define the key for this EntityType.\r\nClaims: EntityType: EntitySet 'Claims' is based on type 'Claim' that has no keys defined.\r\nClaimsIdentities: EntityType: EntitySet 'ClaimsIdentities' is based on type 'ClaimsIdentity' that has no keys defined.\r\nIdentityReferences: EntityType: EntitySet 'IdentityReferences' is based on type 'IdentityReference' that has no keys defined.\r\nSecrets: EntityType: EntitySet 'Secrets' is based on type 'Secret' that has no keys defined.\r\nRefreshTokens: EntityType: EntitySet 'RefreshTokens' is based on type 'RefreshToken' that has no keys defined.\r\nTokens: EntityType: EntitySet 'Tokens' is based on type 'Token' that has no keys defined.\r\nScopes: EntityType: EntitySet 'Scopes' is based on type 'Scope' that has no keys defined.\r\nScopeClaims: EntityType: EntitySet 'ScopeClaims' is based on type 'ScopeClaim' that has no keys defined.\r\n"
I thought this might be because I was missing a package, so I used NuGet to install IdentityServer3.EntityFramework but this didn't work. Does anyone know how to solve this issue?
...ANSWER
Answered 2017-Sep-07 at 14:39This was straight forward enough, you do have to have IdentityServer3.EntityFramework. I looked at the source and saw the migration classes, so I just simply added the entities to my DbContext like this:
QUESTION
I have used IdentityServer3.EntityFramework library to keep all configuration in SQL database. Also I'm using IdentityServer3.AspNetIdentity plugin for identity management. I can't find out how to link / map these 2 database together. I mean base on which concepts. Do I need to have UserId in Config database or should I match user claims with config claims ?
...ANSWER
Answered 2017-Feb-02 at 18:35The claims in the ASP.NET Identity database are claims about that user. This will include a claim type and a claim value (e.g. given_name
and scott
).
The scope claims within the IdentityServer scopes are what claim types a token can contain if the token has that scope. This is only ever a claim type (e.g. if I request a token with the profile
scope, it can contain a users given_name
).
The client claims within the IdentityServer client applications are what hardcoded claims that client application will receive in a token. This will include a claim type and a claim value (e.g. client_name
and mvcapp
).
QUESTION
I am implementing an IdentityServer3 application, while closely following the EntityFramework IdentityServer3 solution. However, the problem is this...
When a Token object is saved, if the Claims are not somehow linked to the Token when the Token is saved here it will inevitably result in unauthorized requests when your client calls your resource server. This happens when the Token is loaded from the database because the Claims that were originally attached to the Token are no longer existent (since they were not saved).
The in memory solution in IdentityServer3 does not have this issue because your object stays in memory, so the list of claims inside the Token object stay "attached" to the token. See here for the in memory solution.
If you don't link claims to the Token upon the save, a reference token cannot be verified when it is retrieved from the database.
I imagine you need to save the relationship between the Claims and the Token when you save the Token. However, this is problematic because at that point in the code (see here) you cannot easily and reliably determine if a Claim is a Scope Claim, Client Claim or a User claim.
How will you properly insert a record into a joining/linking table that would link the Token to the correct claims table? Since there is a ScopeClaims table, a ClientClaims table and there can be a UserClaims table... Usually the claims associated with any given Token are a mixture of Client, Scope and User claims.
What are the recommendations for handling the Token save in such a way that it will keep the claims?
Update As John pointed out, the EF solution serializes the entire Token object at save time so when the Token is queried a deserialization process occurs that re-hydrates the Claims and other fields that were in the Token. Following this approach you do not have to figure out a way to link the Claims to the Token using a join table or something similar. I initially overlooked this important functionality.
...ANSWER
Answered 2017-Jan-22 at 10:47One approach is to follow what how the EF implementation handles it - by storing the extra claims as a serialized JSON string. Since that is written by the authors of idsrv, it's also a great reference :)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install IdentityServer3.EntityFramework
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page