コード例 #1
0
        public static void UpdateEntity(this Models.IdentityProvider idp, Entities.IdentityProvider entity)
        {
            if (idp == null || entity == null)
            {
                return;
            }

            entity.ID = idp.ID;
            entity.Name = idp.Name;
            entity.Enabled = idp.Enabled;
            entity.ShowInHrdSelection = idp.ShowInHrdSelection;
            entity.DisplayName = idp.DisplayName;
            entity.Type = (int)idp.Type;
            entity.WSFederationEndpoint = idp.WSFederationEndpoint;
            entity.IssuerThumbprint = idp.IssuerThumbprint;
            entity.ClientID = idp.ClientID;
            entity.ClientSecret = idp.ClientSecret;
            entity.OAuth2ProviderType = (int?)idp.ProviderType;
        }
コード例 #2
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;
 }
コード例 #3
0
 public static void UpdateEntity(this Models.UserProfile profile, Entities.UserProfile target)  //JWIJDE20130201 Mapper function during update..
 {
     target.City = profile.City;
     target.Country = profile.Country.ToString();
     target.Email = profile.Email;
     target.FirstName = profile.FirstName;
     target.HouseNumber = profile.HouseNumber;
     target.LastName = profile.LastName;
     target.Phone = profile.Phone;
     target.PhoneMobile = profile.PhoneMobile;
     target.PhoneWork = profile.PhoneWork;
     target.PostCode = profile.PostCode;
     //target.Roles,
     target.Salutation = profile.Salutation.ToString();
     target.Street = profile.Street;
     target.Surname = profile.MiddleName; //aware: JWIJ20130206, property difference
     target.UserId = profile.UserId;
     target.ExternalUniqueKey = profile.ExternalUniqueKey;
     target.HouseNumberExtension = profile.HouseNumberExtension;
     target.IsDirty = profile.IsDirty;
     target.IsVerified = profile.IsVerified;
 }
コード例 #4
0
        public static void UpdateEntity(this Models.OpenIdConnectClient client, Entities.OpenIdConnectClientEntity target)
        {
            target.ClientId = client.ClientId;
            target.AccessTokenLifetime = client.AccessTokenLifetime;
            target.AllowRefreshToken = client.AllowRefreshToken;
            target.ClientSecretType = client.ClientSecretType;
            target.Flow = client.Flow;
            target.Name = client.Name;
            target.RefreshTokenLifetime = client.RefreshTokenLifetime;
            target.RequireConsent = client.RequireConsent;
            
            if (!String.IsNullOrWhiteSpace(client.ClientSecret))
            {
                target.ClientSecret = Thinktecture.IdentityServer.Helper.CryptoHelper.HashPassword(client.ClientSecret);
            }

            if (client.RedirectUris != null)
            {
                var urlsToRemove = target.RedirectUris.Where(x => !client.RedirectUris.Contains(x.RedirectUri)).ToArray();
                foreach (var remove in urlsToRemove)
                {
                    target.RedirectUris.Remove(remove);
                }
            }

            if (client.RedirectUris != null)
            {
                var urlsToAdd = target.RedirectUris != null ?
                    client.RedirectUris.Where(x => !target.RedirectUris.Any(y => y.RedirectUri == x)).ToArray() :
                    client.RedirectUris;
                foreach (var add in urlsToAdd)
                {
                    target.RedirectUris.Add(new OpenIdConnectClientRedirectUri { RedirectUri = add });
                }
            }
        }
コード例 #5
0
 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;
 }