Exemple #1
0
        protected override void ProcessRecord()
        {
            var client = new Client()
            {
                ClientId = ClientId, ClientName = ClientName
            };

            client.AbsoluteRefreshTokenLifetime =
                AbsoluteRefreshTokenLifetime.GetValueOrDefault(client.AbsoluteRefreshTokenLifetime);
            client.AccessTokenLifetime       = AccessTokenLifetime.GetValueOrDefault(client.AccessTokenLifetime);
            client.AccessTokenType           = AccessTokenType.GetValueOrDefault(client.AccessTokenType);
            client.AllowLocalLogin           = AllowLocalLogin.GetValueOrDefault(client.AllowLocalLogin);
            client.AllowRememberConsent      = AllowRememberConsent.GetValueOrDefault(client.AllowRememberConsent);
            client.AuthorizationCodeLifetime =
                AuthorizationCodeLifetime.GetValueOrDefault(client.AuthorizationCodeLifetime);
            client.ClientSecret = ClientSecret;
            client.ClientUri    = ClientUri;
            client.Enabled      = Enabled.GetValueOrDefault(client.Enabled);
            client.Flow         = Flow.GetValueOrDefault(client.Flow);
            client.IdentityProviderRestrictions = IdentityProviderRestrictions ?? client.IdentityProviderRestrictions;
            client.IdentityTokenLifetime        = IdentityTokenLifetime.GetValueOrDefault(client.IdentityTokenLifetime);
            client.IdentityTokenSigningKeyType  =
                IdentityTokenSigningKeyType.GetValueOrDefault(client.IdentityTokenSigningKeyType);
            client.LogoUri = string.IsNullOrEmpty(LogoUri) ? null : new Uri(LogoUri);

            client.PostLogoutRedirectUris.AddRange((PostLogoutRedirectUris ?? new string[] { }).Select(x => new Uri(x)));
            client.RedirectUris.AddRange((RedirectUris ?? new string[] { }).Select(x => new Uri(x)));
            client.RefreshTokenExpiration = RefreshTokenExpiration.GetValueOrDefault(client.RefreshTokenExpiration);
            client.RefreshTokenUsage      = RefreshTokenUsage.GetValueOrDefault(client.RefreshTokenUsage);
            client.RequireConsent         = RequireConsent.GetValueOrDefault(client.RequireConsent);
            client.ScopeRestrictions.AddRange(ScopeRestrictions ?? new string[] {});
            client.SlidingRefreshTokenLifetime =
                SlidingRefreshTokenLifetime.GetValueOrDefault(client.SlidingRefreshTokenLifetime);
            WriteObject(client);
        }
Exemple #2
0
        public override bool Equals(object obj)
        {
            var other = obj as ClientModel;

            if (other == null)
            {
                return(false);
            }

            var result =
                AbsoluteRefreshTokenLifetime.SafeEquals(other.AbsoluteRefreshTokenLifetime) &&
                AccessTokenLifetime.SafeEquals(other.AccessTokenLifetime) &&
                AccessTokenType.SafeEquals(other.AccessTokenType) &&
                AllowAccessTokensViaBrowser.SafeEquals(other.AllowAccessTokensViaBrowser) &&
                AllowedCorsOrigins.SafeListEquals(other.AllowedCorsOrigins) &&
                AllowedGrantTypes.SafeListEquals(other.AllowedGrantTypes) &&
                AllowedScopes.SafeListEquals(other.AllowedScopes) &&
                AllowOfflineAccess.SafeEquals(other.AllowOfflineAccess) &&
                AllowPlainTextPkce.SafeEquals(other.AllowPlainTextPkce) &&
                AllowRememberConsent.SafeEquals(other.AllowRememberConsent) &&
                AlwaysSendClientClaims.SafeEquals(other.AlwaysSendClientClaims) &&
                AuthorizationCodeLifetime.SafeEquals(other.AuthorizationCodeLifetime) &&
                BackChannelLogoutSessionRequired.SafeEquals(other.BackChannelLogoutSessionRequired) &&
                BackChannelLogoutUri.SafeEquals(other.BackChannelLogoutUri) &&
                Claims.SafeListEquals(other.Claims) &&
                ClientId.SafeEquals(other.ClientId) &&
                ClientName.SafeEquals(other.ClientName) &&
                ClientSecrets.SafeListEquals(other.ClientSecrets) &&
                ClientUri.SafeEquals(other.ClientUri) &&
                ConsentLifetime.SafeEquals(other.ConsentLifetime) &&
                Enabled.SafeEquals(other.Enabled) &&
                EnableLocalLogin.SafeEquals(other.EnableLocalLogin) &&
                FrontChannelLogoutSessionRequired.SafeEquals(other.FrontChannelLogoutSessionRequired) &&
                FrontChannelLogoutUri.SafeEquals(other.FrontChannelLogoutUri) &&
                IdentityProviderRestrictions.SafeListEquals(other.IdentityProviderRestrictions) &&
                IdentityTokenLifetime.SafeEquals(other.IdentityTokenLifetime) &&
                IncludeJwtId.SafeEquals(other.IncludeJwtId) &&
                LogoUri.SafeEquals(other.LogoUri) &&
                LogoutSessionRequired.SafeEquals(other.LogoutSessionRequired) &&
                LogoutUri.SafeEquals(other.LogoutUri) &&
                PostLogoutRedirectUris.SafeListEquals(other.PostLogoutRedirectUris) &&
                Properties.SafeEquals(other.Properties) &&
                ProtocolType.SafeEquals(other.ProtocolType) &&
                RedirectUris.SafeListEquals(other.RedirectUris) &&
                RefreshTokenExpiration.SafeEquals(other.RefreshTokenExpiration) &&
                RefreshTokenUsage.SafeEquals(other.RefreshTokenUsage) &&
                RequireClientSecret.SafeEquals(other.RequireClientSecret) &&
                RequireConsent.SafeEquals(other.RequireConsent) &&
                RequirePkce.SafeEquals(other.RequirePkce) &&
                SlidingRefreshTokenLifetime.SafeEquals(other.SlidingRefreshTokenLifetime) &&
                UpdateAccessTokenClaimsOnRefresh.SafeEquals(other.UpdateAccessTokenClaimsOnRefresh);

            return(result);
        }
        protected override void ProcessRecord()
        {
            var client = new Client()
            {
                ClientId = ClientId, ClientName = ClientName
            };

            client.AbsoluteRefreshTokenLifetime =
                AbsoluteRefreshTokenLifetime.GetValueOrDefault(client.AbsoluteRefreshTokenLifetime);
            client.AccessTokenLifetime       = AccessTokenLifetime.GetValueOrDefault(client.AccessTokenLifetime);
            client.AccessTokenType           = AccessTokenType.GetValueOrDefault(client.AccessTokenType);
            client.EnableLocalLogin          = EnableLocalLogin.GetValueOrDefault(client.EnableLocalLogin);
            client.AllowRememberConsent      = AllowRememberConsent.GetValueOrDefault(client.AllowRememberConsent);
            client.AuthorizationCodeLifetime =
                AuthorizationCodeLifetime.GetValueOrDefault(client.AuthorizationCodeLifetime);

            client.ClientSecrets = (ClientSecrets ?? new Secret[] { }).ToList();
            client.ClientUri     = ClientUri;
            client.Enabled       = Enabled.GetValueOrDefault(client.Enabled);
            client.Flow          = Flow.GetValueOrDefault(client.Flow);
            client.IdentityProviderRestrictions = (IdentityProviderRestrictions ?? client.IdentityProviderRestrictions.ToArray()).ToList();
            client.IdentityTokenLifetime        = IdentityTokenLifetime.GetValueOrDefault(client.IdentityTokenLifetime);
            client.LogoUri = LogoUri;

            client.PostLogoutRedirectUris.AddRange(PostLogoutRedirectUris ?? new string[] { });
            client.RedirectUris.AddRange(RedirectUris ?? new string[] { });
            client.RefreshTokenExpiration = RefreshTokenExpiration.GetValueOrDefault(client.RefreshTokenExpiration);
            client.RefreshTokenUsage      = RefreshTokenUsage.GetValueOrDefault(client.RefreshTokenUsage);
            client.RequireConsent         = RequireConsent.GetValueOrDefault(client.RequireConsent);
            client.AllowedScopes.AddRange(AllowedScopes ?? new string[] { });
            client.SlidingRefreshTokenLifetime =
                SlidingRefreshTokenLifetime.GetValueOrDefault(client.SlidingRefreshTokenLifetime);
            client.IncludeJwtId           = IncludeJwtId.GetValueOrDefault(client.IncludeJwtId);
            client.AlwaysSendClientClaims = AlwaysSendClientClaims.GetValueOrDefault(client.AlwaysSendClientClaims);
            client.PrefixClientClaims     = PrefixClientClaims.GetValueOrDefault(client.PrefixClientClaims);
            client.Claims.AddRange((Claims ?? new Claim[] { }));
            client.AllowedCustomGrantTypes.AddRange((AllowedCustomGrantTypes ?? new string[] { }));
            client.AllowClientCredentialsOnly =
                AllowClientCredentialsOnly.GetValueOrDefault(client.AllowClientCredentialsOnly);
            client.AllowedCorsOrigins.AddRange(AllowedCorsOrigins ?? new String[] { });
            client.UpdateAccessTokenClaimsOnRefresh =
                UpdateAccessTokenClaimsOnRefresh.GetValueOrDefault(client.UpdateAccessTokenClaimsOnRefresh);
            client.AllowAccessToAllScopes           = AllowAccessToAllScopes.GetValueOrDefault(client.AllowAccessToAllScopes);
            client.AllowAccessToAllCustomGrantTypes = AllowAccessToAllCustomGrantTypes.GetValueOrDefault(client.AllowAccessToAllCustomGrantTypes);
            client.AllowAccessTokensViaBrowser      = AllowAccessTokensViaBrowser.GetValueOrDefault(client.AllowAccessTokensViaBrowser);
            client.LogoutSessionRequired            = LogoutSessionRequired.GetValueOrDefault(client.LogoutSessionRequired);
            client.RequireSignOutPrompt             = RequireSignOutPrompt.GetValueOrDefault(client.RequireSignOutPrompt);
            client.LogoutUri = LogoutUri;
            WriteObject(client);
        }