Esempio n. 1
0
 private bool CheckApiScopeAndApiScopeData(ApiScopeData data, IdentityApiScope apiScope)
 {
     return
         (data != null
          &&
          apiScope != null
          &&
          data.Name == apiScope.Name
          &&
          data.DisplayName == apiScope.DisplayName
          &&
          data.Description == apiScope.Description
          &&
          data.Enabled == apiScope.Enabled);
 }
Esempio n. 2
0
 private static void SeedApiScopeClaims(IAdminStore <Entity.ApiScopeClaim> apiScopeClaimStore, IdentityServer4.Models.ApiScope resource)
 {
     foreach (var claim in resource.UserClaims)
     {
         apiScopeClaimStore.CreateAsync(new Entity.ApiScopeClaim
         {
             ApiScopeId = resource.Name,
             Id         = Guid.NewGuid().ToString(),
             Type       = claim
         }).GetAwaiter().GetResult();
     }
 }
Esempio n. 3
0
 private static void SeedApiScopeProperties(IAdminStore <Entity.ApiScopeProperty> apiScopePropertyStore, IdentityServer4.Models.ApiScope resource)
 {
     foreach (var property in resource.Properties)
     {
         apiScopePropertyStore.CreateAsync(new Entity.ApiScopeProperty
         {
             ApiScopeId = resource.Name,
             Id         = Guid.NewGuid().ToString(),
             Key        = property.Key,
             Value      = property.Value
         }).GetAwaiter().GetResult();
     }
 }
Esempio n. 4
0
 public void UpdateApiScope(ApiScope obj) => Update(obj.ToEntity());
Esempio n. 5
0
 public void RemoveApiScope(ApiScope obj) => Remove(obj.ToEntity());
Esempio n. 6
0
 public void AddApiScope(ApiScope obj) => Add(obj.ToEntity());
Esempio n. 7
0
 /// <summary>
 /// Maps a model to an entity.
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns></returns>
 public static Scope ToEntity(this IdentityServer4.Models.ApiScope model)
 {
     return(model == null ? null : Mapper.Map <Scope>(model));
 }