public static void EnsureSeedData(this SimpleIdServerUmaContext context)
 {
     InsertResources(context);
     InsertPolicies(context);
     try
     {
         context.SaveChanges();
     }
     catch { }
 }
Ejemplo n.º 2
0
 public static void EnsureSeedData(this SimpleIdServerUmaContext context)
 {
     InsertResources(context);
     try
     {
         context.SaveChanges();
     }
     catch
     {
         Trace.WriteLine("already exists");
     }
 }
 private static void InsertPolicies(SimpleIdServerUmaContext context)
 {
     if (!context.Policies.Any())
     {
         context.Policies.AddRange(new[]
         {
             new Policy
             {
                 Id = _firstPolicyId
             }
         });
     }
 }
 private static void InsertResources(SimpleIdServerUmaContext context)
 {
     if (!context.ResourceSets.Any())
     {
         context.ResourceSets.AddRange(new[]
         {
             new ResourceSet
             {
                 Id     = "1",
                 Name   = "Access to administrator",
                 Scopes = "read,write,execute"
             }
         });
     }
 }
Ejemplo n.º 5
0
 private static void InsertResources(SimpleIdServerUmaContext context)
 {
     if (!context.ResourceSets.Any())
     {
         context.ResourceSets.AddRange(new[]
         {
             new ResourceSet
             {
                 Id   = "bad180b5-4a96-422d-a088-c71a9f7c7afc",
                 Name = "Resources"
             },
             new ResourceSet
             {
                 Id   = "67c50eac-23ef-41f0-899c-dffc03add961",
                 Name = "Apis"
             }
         });
     }
 }
 private static void InsertPolicyRules(SimpleIdServerUmaContext context)
 {
     if (!context.Policies.Any())
     {
         var claims = new List <Core.Models.Claim>();
         claims.Add(new Core.Models.Claim {
             Type = "name", Value = "thabart"
         });
         context.PolicyRules.AddRange(new[]
         {
             new PolicyRule
             {
                 Id       = Guid.NewGuid().ToString(),
                 PolicyId = _firstPolicyId,
                 IsResourceOwnerConsentNeeded = false,
                 Scopes = "read,write,execute",
                 Claims = JsonConvert.SerializeObject(claims)
             }
         });
     }
 }
 private static void InsertPolicies(SimpleIdServerUmaContext context)
 {
     if (!context.Policies.Any())
     {
         var claims = new List <Core.Models.Claim>();
         claims.Add(new Core.Models.Claim {
             Type = "sub", Value = "administrator"
         });
         context.Policies.AddRange(new[]
         {
             new Policy
             {
                 Id = _firstPolicyId,
                 PolicyResources = new List <PolicyResource>
                 {
                     new PolicyResource
                     {
                         PolicyId      = _firstPolicyId,
                         ResourceSetId = "1"
                     }
                 },
                 Rules = new List <PolicyRule>
                 {
                     new PolicyRule
                     {
                         Id       = Guid.NewGuid().ToString(),
                         PolicyId = _firstPolicyId,
                         IsResourceOwnerConsentNeeded = false,
                         ClientIdsAllowed             = "",
                         Scopes         = "read,write,execute",
                         Claims         = JsonConvert.SerializeObject(claims),
                         OpenIdProvider = "http://localhost:60000/.well-known/openid-configuration"
                     }
                 }
             }
         });
     }
 }
 public PolicyRepository(SimpleIdServerUmaContext context)
 {
     _context = context;
 }
 public SharedLinkRepository(SimpleIdServerUmaContext context)
 {
     _context = context;
 }
Ejemplo n.º 10
0
 public ResourceSetRepository(SimpleIdServerUmaContext context)
 {
     _context = context;
 }
 public ScopeRepository(SimpleIdServerUmaContext context)
 {
     _context = context;
 }
 public PendingRequestRepository(SimpleIdServerUmaContext context)
 {
     _context = context;
 }
Ejemplo n.º 13
0
 public static void EnsureSeedData(this SimpleIdServerUmaContext context)
 {
     InsertResources(context);
     context.SaveChanges();
 }
Ejemplo n.º 14
0
 public TicketRepository(SimpleIdServerUmaContext context)
 {
     _context = context;
 }