Esempio n. 1
0
 public static void UpdateEntity(this Models.Client client, Entities.Client target)
 {
     target.Id                     = client.ID;
     target.ClientId               = client.ClientId;
     target.ClientSecret           = client.ClientSecret;
     target.Description            = client.Description;
     target.Name                   = client.Name;
     target.RedirectUri            = client.RedirectUri != null ? client.RedirectUri.AbsoluteUri : null;
     target.NativeClient           = client.NativeClient;
     target.AllowResourceOwnerFlow = client.AllowResourceOwnerFlow;
     target.AllowImplicitFlow      = client.AllowImplicitFlow;
     target.AllowCodeFlow          = client.AllowCodeFlow;
 }
Esempio n. 2
0
 public static Models.Client ToDomainModel(this Entities.Client client)
 {
     return(new Models.Client
     {
         ID = client.Id,
         ClientId = client.ClientId,
         ClientSecret = client.ClientSecret,
         Description = client.Description,
         Name = client.Name,
         RedirectUri = client.RedirectUri != null ? new Uri(client.RedirectUri) : null,
         NativeClient = client.NativeClient,
         AllowCodeFlow = client.AllowCodeFlow,
         AllowImplicitFlow = client.AllowImplicitFlow,
         AllowResourceOwnerFlow = client.AllowResourceOwnerFlow
     });
 }
 public static void UpdateEntity(this Models.Client client, Entities.Client target)
 {
     target.Id       = client.ID;
     target.ClientId = client.ClientId;
     if (!String.IsNullOrWhiteSpace(client.ClientSecret))
     {
         target.ClientSecret = Thinktecture.IdentityServer.Helper.CryptoHelper.HashPassword(client.ClientSecret);
     }
     target.Description            = client.Description;
     target.Name                   = client.Name;
     target.RedirectUri            = client.RedirectUri != null ? client.RedirectUri.AbsoluteUri : null;
     target.AllowRefreshToken      = client.AllowRefreshToken;
     target.AllowResourceOwnerFlow = client.AllowResourceOwnerFlow;
     target.AllowImplicitFlow      = client.AllowImplicitFlow;
     target.AllowCodeFlow          = client.AllowCodeFlow;
 }
 public static Models.Client ToDomainModel(this Entities.Client client)
 {
     return(new Models.Client
     {
         ID = client.Id,
         ClientId = client.ClientId,
         //ClientSecret = client.ClientSecret,
         HasClientSecret = !String.IsNullOrWhiteSpace(client.ClientSecret),
         Description = client.Description,
         Name = client.Name,
         RedirectUri = client.RedirectUri != null ? new Uri(client.RedirectUri) : null,
         AllowRefreshToken = client.AllowRefreshToken,
         AllowCodeFlow = client.AllowCodeFlow,
         AllowImplicitFlow = client.AllowImplicitFlow,
         AllowResourceOwnerFlow = client.AllowResourceOwnerFlow
     });
 }
        public void Create(Models.Client model)
        {
            if (model == null) throw new ArgumentException("model");

            using (var entities = IdentityServerConfigurationContext.Get())
            {
                var item = new Client();
                model.UpdateEntity(item);
                entities.Clients.Add(item);
                entities.SaveChanges();
                model.ID = item.Id;
            }
        }