예제 #1
0
        public QueryContext()
        {
            Issuer     = new GraphIssuer();
            Targets    = new Dictionary <int, GraphIssuer>();
            ClaimTypes = new List <int>();
            Errors     = new List <string>();

            MaxCost  = 500;
            Level    = 0;
            MaxLevel = 3; // About 3 levels down max!
        }
예제 #2
0
        internal void SetupIssuers(QueryRequest query)
        {
            if (!GraphTrustService.Graph.IssuerIndex.ContainsKey(query.Issuer.Id))
            {
                Errors.Add($"Unknown Issuer {query.Issuer.Id}");
                return;
            }

            var index = GraphTrustService.Graph.IssuerIndex[query.Issuer.Id];

            Issuer = GraphTrustService.Graph.Issuers[index];
        }
        public void AddSubjectAndClaim(GraphIssuer subject, int claimIndex)
        {
            if (Subjects == null)
            {
                Subjects = new Dictionary <int, GraphSubject>();
            }

            if (!Subjects.ContainsKey(subject.Index))
            {
                var graphSubject = new GraphSubject
                {
                    TargetIssuer = subject
                };
                graphSubject.AddClaim(claimIndex);
                Subjects.Add(subject.Index, graphSubject);
            }
            else
            {
                Subjects[subject.Index].AddClaim(claimIndex);
            }
        }
        public GraphSubject AddGraphSubject(GraphIssuer subject)
        {
            if (Subjects == null)
            {
                Subjects = new Dictionary <int, GraphSubject>();
            }

            if (!Subjects.ContainsKey(subject.Index))
            {
                var graphSubject = new GraphSubject
                {
                    TargetIssuer = subject
                };
                Subjects.Add(subject.Index, graphSubject);
                return(graphSubject);
            }
            else
            {
                return(Subjects[subject.Index]);
            }
        }
예제 #5
0
 public GraphTracker(GraphIssuer issuer)
 {
     SubjectKey = -1;
     Issuer     = issuer;
 }