Giter Club home page Giter Club logo

identitydocumentdb's People

Contributors

dependabot[bot] avatar dlmelendez avatar tomlm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

identitydocumentdb's Issues

Exception using v 1.15.0 of Microsoft.Azure.DocumentDB nuget.

Upgraded to latest stable v 1.15.0 of Microsoft.Azure.DocumentDB nuget and I'm getting the following exception.

System.MissingMethodException occurred HResult=0x80131513 Message=Method not found: 'Void Microsoft.Azure.Documents.Client.DocumentClient..ctor(System.Uri, System.String, Microsoft.Azure.Documents.Client.ConnectionPolicy, System.Nullable1<Microsoft.Azure.Documents.ConsistencyLevel>)'.
Source=ElCamino.AspNet.Identity.DocumentDB
StackTrace:
at ElCamino.AspNet.Identity.DocumentDB.IdentityCloudContext6..ctor(String uri, String authKey, String database, ConnectionPolicy policy, String usersCollection, String rolesCollection) at ElCamino.AspNet.Identity.DocumentDB.IdentityCloudContext1..ctor(String uri, String authKey, String database, ConnectionPolicy policy, String usersCollectionName, String rolesCollectionName)`

Can’t view data in Azure CosmosDB Data Explorer

This may not be a bug with ElCamino.AspNet.Identity.DocumentDB which is what I am using to interface with Azure CosmosDB. I am able to create dabase and collection on the fly and I am able to add/update items just fine. However, when I go to Azure and try to see the data in Data Explorer I get error saying {"code":500,"body":"Object reference not set to an instance of an object."}.

Anyone encountered this problem?

I think it has to do with Azure interface but I suspect if ElCamino.AspNet.Identity.DocumentDB is out of sync with Azure on data layout. I am doing a POC and ElCamino saved me time. Hope I don't have to reinvent my own documentdb repository myself!

I would appreciate your feedback.

Thanks,
Prodip

Error with user.SelfLink

Hi, I get an error in this line Into ExternalLoginConfirmation Method in AccountController:

result = await _userManager.AddLoginAsync(user, info);

Looking at source files, It seems that the property user.SelfLink is null into UpdateAsync Method.

Thanks.

Unable to add claims

When adding claims, I get an "ArgumentNullException: Value cannot be null. Parameter name: documentLink" after successfully creating a user...

result = await userManager.AddClaimAsync(user, new Claim(ClaimTypes.Role, "Admin")).ConfigureAwait(false);

better async code ?

I don't quite understand why the async code is written in this way: Start a new task, then block that task in waiting.

e.g. Current code:

        public async virtual Task CreateAsync(TUser user)
        {
    ......
            await new TaskFactory().StartNew(() =>
            {
                var docTask = Context.Client.CreateDocumentAsync(Context.UserDocumentCollection.DocumentsLink, user
                    , Context.RequestOptions, true);
                docTask.Wait();
                var doc = docTask.Result;
                Context.SetSessionTokenIfEmpty(doc.SessionToken);
                JsonConvert.PopulateObject(doc.Resource.ToString(), user);
            });

        }

Can it be simplified as below code?

        public async virtual Task CreateAsync(TUser user)
        {
    ......
            var response = await Context.Client.CreateDocumentAsync(Context.UserDocumentCollection.DocumentsLink, user
                    , Context.RequestOptions, true);

            Context.SetSessionTokenIfEmpty(response.SessionToken);
        }

User defined collection names

Since DocumentDB on Azure now charges by the collection, it makes more sense to let the user of this library control where the UserStore and RoleStore are backed in the database.

I have modified the Constants file so that it reads the UsersCollection and RolesCollection names from the WebConfig file instead of being hard-coded by the library.

For instance:

public static class AppSettingsKeys
        {
            public const string DatabaseNameKey = "IdDocDb_Database";
            public const string DatabaseUriKey = "IdDocDb_Uri";
            public const string DatabaseAuthKey = "IdDocDb_AuthKey";
            public const string RolesCollectionKey = "IdDocDb_RolesCollectionKey";
            public const string UsersCollectionKey = "IdDocDb_UsersCollectionKey";
        }

public static class DocumentCollectionIds
        {
            private static string _rolesCollection;
            private static string _usersCollection;

            public static string RolesCollection
            {
                get
                {
                    if (string.IsNullOrEmpty(_rolesCollection))
                    {
                        _rolesCollection = ConfigurationManager.AppSettings[AppSettingsKeys.RolesCollectionKey];
                    }
                    return _rolesCollection;
                }
            }

            public static string UsersCollection
            {
                get
                {
                    if (string.IsNullOrEmpty(_usersCollection))
                    {
                        _usersCollection = ConfigurationManager.AppSettings[AppSettingsKeys.UsersCollectionKey];
                    }
                    return _usersCollection;
                }
            }
        }

Let me know if you'd like me to create a pull request to submit this work.

Cheers,
Jon

Roles sample

could you please provide a sample on how to use Roles with this provider ?

Using single document collection and compound partition key

Hi David, firstly really appreciate the work you've put into this. I've already built a user store, login, password hashing and Jwt token services - then found your library when researching the Asp.Net identity and store provider model.

I've rolled all my entities into a single collection using a compound partion key "pkey" which starts with the entity type name. I've simply added "Entity" as a base class into your inheritance chain for the Models, it contains an abstract string getter "pkey" - each class can then implement it's own compound string from its own members. the base class Entity takes care of adding the instance typename as a prefix.

The immediate benefit of this is being able to easily browse a mixture of records in the collection. I have yet to load test this approach - querying tens or hundreds of thousands of records.

The cost of each separate partition made me decide to try putting all my relatively static entities into the same partition - users, organizations, roles, inventory, etc

Apologies for polluting your issues list with this - if you have time would appreciate any suggestions or thoughts around this.

Regards
Andy Welch, NZ

Sample roles use

Is possible for you to update the sample app to show the use with roles? I couldn't find any.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.