Comments (8)
I'm going to try to put up my fork of this which addresses the partitioning issue within the next week or so. But you'll have lots of breaking changes since I changed all the naming conventions of classes and other properties to be more generic for Identity.
For now, you can just add the following parameter to each document query and recompile this project:
new FeedOptions { EnableCrossPartitionQuery = true }
from aspnetcore.identity.documentdb.
It seems you are using DocumentDb automatic partitioning which is unfortunately not yet supported with this provider (see #1) as I did not find a solution yet on how to do support this in an as generic as possible way. There needs to be a possibility to tell this provider how you want to have your data partitioned, and I don't want to force the user of this provider into any partitioning strategy defined by me (i.e. by e-mail TLD or something, that might not be the best solution for everyone).
Currently you have two options when you want to use this provider:
- For users and roles, add an additional, not auto-partitioned collection to your DocumentDb. Depending on the load you expect on this collection, it might not be an option.
- Fork this project and add the required code to support partitioning for your specific scenario. If you don't have to support a generic solution, it's pretty easy to implement (you know, pass the partition key on queries and so forth). If you need help on where to add the required bits, let me know.
Else, you'd have to wait until I come up with a generic solution that lets you configure this provider on how it should partition your data.
from aspnetcore.identity.documentdb.
As discussed, this behavior is as designed. Please track #1 to see progress on implementing support for partitioning.
from aspnetcore.identity.documentdb.
Sorry to bring up an old issue, but I'm working with your library and would like to add my own support for partitioning. I think I have it mostly working except when the FindByIdAsync method is called on the user store. I have my partition for users as the domain name of the email address and I can't think of a way to figure out what that would be based on the user id.
It also appears to me that you can't enable cross partition queries for RequestOptions so I have to supply the correct partition key.
Any thoughts on how I can solve this? I apologize if I'm going about this the wrong way, I'm new to Github and Cosmos DB and I'm learning as I go.
Thanks for any help you can give,
Greg
from aspnetcore.identity.documentdb.
@greg-dickie Yea, that's a huge problem. I'm thinking about how to tackle support for partitioning for a while now - see #1 - but it's very tricky because of how ASP.NET Identity works and you can end up with just knowing about the User ID and nothing else.
So actually you would have to have some information within the UserId that tells you which partition to use. Or you could use some lookup store where you cache/hold a mapping from UserId to it's partition (maybe in another DocumentDb Collection, in a Redis Cache, ...) - all of this would of course require a custom implementation.
What this all comes down to would be a custom implementation of ASP.NET Identity if one would want to generalize partitioning support -and that's pretty much out of scope :). Personally, I moved on from using ASP.NET Identity with Documentdb when auto partitioning is required - for an application I'm currently developing I store the users in Azure AD B2C only (instead of storing them in DocumentDb and using IdentityServer based on that user store).
from aspnetcore.identity.documentdb.
from aspnetcore.identity.documentdb.
I found this guide on how to set up Cosmos DB with Azure Ad B2C using a function app. I am surprised Microsoft hasn't given us more "how to examples" with this scenario. With 5g coming out, this is going to be big for cosmos DB.
https://github.com/adamhockemeyer/Azure-Functions---CosmosDB-ResourceToken-Broker
Wiki is here: https://github.com/adamhockemeyer/Azure-Functions---CosmosDB-ResourceToken-Broker/wiki
from aspnetcore.identity.documentdb.
For users and roles, add an additional, not auto-partitioned collection to your DocumentDb.
@codekoenig How exactly do you do that in Cosmos DB?
from aspnetcore.identity.documentdb.
Related Issues (20)
- Has anyone got this running in a web api project? HOT 1
- Not able to compile samples in Visual Studio for Mac HOT 1
- remove claim does not work HOT 3
- AspNetCore 2.0 HOT 8
- Error running application after upgrade to core 2.0 HOT 5
- deserializing claims
- Unable to log back in after creating a user, null as part of the Claims Process
- Take document db collection name as parameter HOT 1
- Claims cannot be deserialized HOT 3
- ObjectDisposedException HOT 1
- Missing method exception after upgrading to SDK 2.1.3
- Question - How are the document updated? HOT 1
- TypeLoadException: Method 'NormalizeName' in type 'LookupNormalizer' does not have an implementation HOT 5
- SSL should be enabled in the sample
- AddDefaultDocumentClientForIdentity is missing from NuGet package HOT 3
- Is it considered to change dependency to Microsoft.Azure.Cosmos?
- Use IDocumentClient instead of DocumentClient HOT 1
- Subclass Userstore to allow using it without any RoleStore
- Adding samples how to use and manage Roles HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspnetcore.identity.documentdb.