コード例 #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);
        }
コード例 #2
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.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);
        }