Git Product home page Git Product logo

Comments (3)

jpage2 avatar jpage2 commented on June 8, 2024 1

I'm also using IdentityServer4 and have it running fine against the
AspNetCore.Identity.DocumentDb . Partitioning is definitely an issue and I'll probably have to go with a Mongo implementation without it. I used this to fix the convert issue.

`public class JsonClaimConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return (objectType == typeof(Claim));
}

    public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
    {
        IList<Claim> claims = new List<Claim>();
        JToken jt = JObject.ReadFrom(reader);
        for (int i = 0; i < jt.Count(); i++)
        {
            string type = jt.Values<string>("Type").ElementAtOrDefault(i);
            string value = jt.Values<string>("Value").ElementAtOrDefault(i);
            string valueType = jt.Values<string>("ValueType").ElementAtOrDefault(i);
            string issuer = jt.Values<string>("Issuer").ElementAtOrDefault(i);
            string originalIssuer = jt.Values<string>("OriginalIssuer").ElementAtOrDefault(i);
            claims.Add(new Claim(type, value, valueType, issuer, originalIssuer));

        }
        return claims;
    }

    public override bool CanWrite
    {
        get { return false; }
    }

    public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
    {

        var claim = (Claim)value;
        JObject jo = new JObject
        {
            { "Type", claim.Type },
            { "Value", claim.Value },
            { "ValueType", claim.ValueType },
            { "Issuer", claim.Issuer },
            { "OriginalIssuer", claim.OriginalIssuer }
        };
        jo.WriteTo(writer);

    }
}`

I also added this to the DocumentDBUserStore for the FindBy... issues.

IQueryable<TUser> IQueryableUserStore<TUser>.Users => documentClient.CreateDocumentQuery<TUser>(collectionUri) .Where(u => u.DocumentType == typeof(TUser).Name) .AsQueryable();

from aspnetcore.identity.documentdb.

vindemi avatar vindemi commented on June 8, 2024

I have the same problem. Is there any work around how to resolve that issue?

from aspnetcore.identity.documentdb.

dominikfoldi avatar dominikfoldi commented on June 8, 2024

@vindemi I have not found any solutions for this issue. If I am not mistaken, Microsoft is working to support JsonConvert.DefaultSettings but I do not have any idea when will they finish it.

Our solution was to not use Claims but Roles instead. The serialization of Roles is not a problem.

But soon we will move to Identity Server with SQL Server because this library is not maintained and it has this issue, also it does not support partitioning so I do not think that it is production ready.

from aspnetcore.identity.documentdb.

Related Issues (20)

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.