Exemple #1
0
 public override object Clone()
 {
     return(new OpenIdClient
     {
         ClientId = ClientId,
         ClientNames = ClientNames == null ? new List <OAuthTranslation>() : ClientNames.Select(c => (OAuthTranslation)c.Clone()).ToList(),
         ClientUris = ClientUris == null ? new List <OAuthTranslation>() : ClientUris.Select(c => (OAuthTranslation)c.Clone()).ToList(),
         LogoUris = LogoUris == null ? new List <OAuthTranslation>() : LogoUris.Select(c => (OAuthTranslation)c.Clone()).ToList(),
         PolicyUris = PolicyUris == null ? new List <OAuthTranslation>() : PolicyUris.Select(c => (OAuthTranslation)c.Clone()).ToList(),
         TosUris = TosUris == null ? new List <OAuthTranslation>() : TosUris.Select(c => (OAuthTranslation)c.Clone()).ToList(),
         CreateDateTime = CreateDateTime,
         JwksUri = JwksUri,
         RefreshTokenExpirationTimeInSeconds = RefreshTokenExpirationTimeInSeconds,
         UpdateDateTime = UpdateDateTime,
         TokenEndPointAuthMethod = TokenEndPointAuthMethod,
         TokenExpirationTimeInSeconds = TokenExpirationTimeInSeconds,
         Secrets = Secrets == null ? new List <ClientSecret>() : Secrets.Select(s => (ClientSecret)s.Clone()).ToList(),
         AllowedScopes = AllowedScopes == null ? new List <OpenIdScope>() : AllowedScopes.Select(s => (OpenIdScope)s.Clone()).ToList(),
         JsonWebKeys = JsonWebKeys == null ? new List <JsonWebKey>() : JsonWebKeys.Select(j => (JsonWebKey)j.Clone()).ToList(),
         GrantTypes = GrantTypes.ToList(),
         RedirectionUrls = RedirectionUrls.ToList(),
         PreferredTokenProfile = PreferredTokenProfile,
         TokenEncryptedResponseAlg = TokenEncryptedResponseAlg,
         TokenEncryptedResponseEnc = TokenEncryptedResponseEnc,
         TokenSignedResponseAlg = TokenSignedResponseAlg,
         ResponseTypes = ResponseTypes.ToList(),
         Contacts = Contacts.ToList(),
         SoftwareId = SoftwareId,
         SoftwareVersion = SoftwareVersion,
         ApplicationType = ApplicationType,
         DefaultAcrValues = DefaultAcrValues.ToList(),
         DefaultMaxAge = DefaultMaxAge,
         IdTokenEncryptedResponseAlg = IdTokenEncryptedResponseAlg,
         IdTokenEncryptedResponseEnc = IdTokenEncryptedResponseEnc,
         IdTokenSignedResponseAlg = IdTokenSignedResponseAlg,
         PairWiseIdentifierSalt = PairWiseIdentifierSalt,
         RequestObjectEncryptionAlg = RequestObjectEncryptionAlg,
         RequestObjectEncryptionEnc = RequestObjectEncryptionEnc,
         RequestObjectSigningAlg = RequestObjectSigningAlg,
         RequireAuthTime = RequireAuthTime,
         SectorIdentifierUri = SectorIdentifierUri,
         SubjectType = SubjectType,
         UserInfoEncryptedResponseAlg = UserInfoEncryptedResponseAlg,
         UserInfoEncryptedResponseEnc = UserInfoEncryptedResponseEnc,
         UserInfoSignedResponseAlg = UserInfoSignedResponseAlg,
         RegistrationAccessToken = RegistrationAccessToken,
         PostLogoutRedirectUris = PostLogoutRedirectUris,
         InitiateLoginUri = InitiateLoginUri
     });
 }
 public virtual object Clone()
 {
     return(new OAuthClient
     {
         ClientId = ClientId,
         ClientNames = ClientNames == null ? new List <OAuthTranslation>() : ClientNames.Select(c => (OAuthTranslation)c.Clone()).ToList(),
         ClientUris = ClientUris == null ? new List <OAuthTranslation>() : ClientUris.Select(c => (OAuthTranslation)c.Clone()).ToList(),
         LogoUris = LogoUris == null ? new List <OAuthTranslation>() : LogoUris.Select(c => (OAuthTranslation)c.Clone()).ToList(),
         PolicyUris = PolicyUris == null ? new List <OAuthTranslation>() : PolicyUris.Select(c => (OAuthTranslation)c.Clone()).ToList(),
         TosUris = TosUris == null ? new List <OAuthTranslation>() : TosUris.Select(c => (OAuthTranslation)c.Clone()).ToList(),
         CreateDateTime = CreateDateTime,
         JwksUri = JwksUri,
         RefreshTokenExpirationTimeInSeconds = RefreshTokenExpirationTimeInSeconds,
         UpdateDateTime = UpdateDateTime,
         TokenEndPointAuthMethod = TokenEndPointAuthMethod,
         TokenExpirationTimeInSeconds = TokenExpirationTimeInSeconds,
         Secrets = Secrets == null ? new List <ClientSecret>() : Secrets.Select(s => (ClientSecret)s.Clone()).ToList(),
         AllowedScopes = AllowedScopes == null ? new List <OAuthScope>() : AllowedScopes.Select(s => (OAuthScope)s.Clone()).ToList(),
         JsonWebKeys = JsonWebKeys == null ? new List <JsonWebKey>() : JsonWebKeys.Select(j => (JsonWebKey)j.Clone()).ToList(),
         GrantTypes = GrantTypes.ToList(),
         RedirectionUrls = RedirectionUrls.ToList(),
         PreferredTokenProfile = PreferredTokenProfile,
         TokenEncryptedResponseAlg = TokenEncryptedResponseAlg,
         TokenEncryptedResponseEnc = TokenEncryptedResponseEnc,
         TokenSignedResponseAlg = TokenSignedResponseAlg,
         ResponseTypes = ResponseTypes.ToList(),
         Contacts = Contacts.ToList(),
         SoftwareId = SoftwareId,
         SoftwareVersion = SoftwareVersion,
         RegistrationAccessToken = RegistrationAccessToken,
         PostLogoutRedirectUris = PostLogoutRedirectUris.ToList(),
         TlsClientAuthSanDNS = TlsClientAuthSanDNS,
         TlsClientAuthSanEmail = TlsClientAuthSanEmail,
         TlsClientAuthSanIP = TlsClientAuthSanIP,
         TlsClientAuthSanURI = TlsClientAuthSanURI,
         TlsClientAuthSubjectDN = TlsClientAuthSubjectDN
     });
 }
 public void UpdateEntity(IdentityServer4.EntityFramework.Entities.Client entity)
 {
     entity.Enabled                          = Enabled;
     entity.ClientId                         = ClientId;
     entity.ProtocolType                     = ProtocolType;
     entity.RequireClientSecret              = RequireClientSecret;
     entity.ClientName                       = ClientName;
     entity.Description                      = Description;
     entity.ClientUri                        = ClientUri;
     entity.LogoUri                          = LogoUri;
     entity.RequireConsent                   = RequireConsent;
     entity.AllowRememberConsent             = AllowRememberConsent;
     entity.AlwaysIncludeUserClaimsInIdToken = AlwaysIncludeUserClaimsInIdToken;
     entity.AllowedGrantTypes                = AllowedGrantTypes.Select(x => new ClientGrantType
     {
         GrantType = x,
     }).ToList();
     entity.RequirePkce                 = RequirePkce;
     entity.AllowPlainTextPkce          = AllowPlainTextPkce;
     entity.AllowAccessTokensViaBrowser = AllowAccessTokensViaBrowser;
     entity.RedirectUris                = RedirectUris.Select(x => new ClientRedirectUri
     {
         RedirectUri = x,
     }).ToList();
     entity.PostLogoutRedirectUris = PostLogoutRedirectUris.Select(x => new ClientPostLogoutRedirectUri
     {
         PostLogoutRedirectUri = x,
     }).ToList();
     entity.FrontChannelLogoutUri             = FrontChannelLogoutUri;
     entity.FrontChannelLogoutSessionRequired = FrontChannelLogoutSessionRequired;
     entity.BackChannelLogoutUri             = BackChannelLogoutUri;
     entity.BackChannelLogoutSessionRequired = BackChannelLogoutSessionRequired;
     entity.AllowOfflineAccess = AllowOfflineAccess;
     entity.AllowedScopes      = AllowedScopes.Select(x => new ClientScope
     {
         Scope = x,
     }).ToList();
     entity.IdentityTokenLifetime            = IdentityTokenLifetime;
     entity.AccessTokenLifetime              = AccessTokenLifetime;
     entity.AuthorizationCodeLifetime        = AuthorizationCodeLifetime;
     entity.ConsentLifetime                  = ConsentLifetime;
     entity.AbsoluteRefreshTokenLifetime     = AbsoluteRefreshTokenLifetime;
     entity.SlidingRefreshTokenLifetime      = SlidingRefreshTokenLifetime;
     entity.RefreshTokenUsage                = (int)RefreshTokenUsage;
     entity.UpdateAccessTokenClaimsOnRefresh = UpdateAccessTokenClaimsOnRefresh;
     entity.RefreshTokenExpiration           = (int)RefreshTokenExpiration;
     entity.AccessTokenType                  = (int)AccessTokenType;
     entity.EnableLocalLogin                 = EnableLocalLogin;
     entity.IdentityProviderRestrictions     = IdentityProviderRestrictions.Select(x => new ClientIdPRestriction
     {
         Provider = x,
     }).ToList();
     entity.IncludeJwtId           = IncludeJwtId;
     entity.AlwaysSendClientClaims = AlwaysSendClientClaims;
     entity.ClientClaimsPrefix     = ClientClaimsPrefix;
     entity.PairWiseSubjectSalt    = PairWiseSubjectSalt;
     entity.AllowedCorsOrigins     = AllowedCorsOrigins.Select(x => new ClientCorsOrigin
     {
         Origin = x,
     }).ToList();
     entity.UserSsoLifetime    = UserSsoLifetime;
     entity.UserCodeType       = UserCodeType;
     entity.DeviceCodeLifetime = DeviceCodeLifetime;
 }