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); }
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); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ClientId != null) { hashCode = hashCode * 59 + ClientId.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (AllowedGrantTypes != null) { hashCode = hashCode * 59 + AllowedGrantTypes.GetHashCode(); } if (RedirectUris != null) { hashCode = hashCode * 59 + RedirectUris.GetHashCode(); } if (AllowedCorsOrigins != null) { hashCode = hashCode * 59 + AllowedCorsOrigins.GetHashCode(); } if (PostLogoutRedirectUris != null) { hashCode = hashCode * 59 + PostLogoutRedirectUris.GetHashCode(); } if (AllowedScopes != null) { hashCode = hashCode * 59 + AllowedScopes.GetHashCode(); } if (ClientSecrets != null) { hashCode = hashCode * 59 + ClientSecrets.GetHashCode(); } if (HashedClientSecrets != null) { hashCode = hashCode * 59 + HashedClientSecrets.GetHashCode(); } hashCode = hashCode * 59 + AllowedOfflineAccess.GetHashCode(); hashCode = hashCode * 59 + AccessTokenLifetime.GetHashCode(); hashCode = hashCode * 59 + IdentityTokenLifetime.GetHashCode(); hashCode = hashCode * 59 + RequireConsent.GetHashCode(); return(hashCode); } }
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); }
/// <summary> /// Returns true if Oauth2ClientSubmit instances are equal /// </summary> /// <param name="other">Instance of Oauth2ClientSubmit to be compared</param> /// <returns>Boolean</returns> public bool Equals(Oauth2ClientSubmit other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( ClientId == other.ClientId || ClientId != null && ClientId.Equals(other.ClientId) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( AllowedGrantTypes == other.AllowedGrantTypes || AllowedGrantTypes != null && other.AllowedGrantTypes != null && AllowedGrantTypes.SequenceEqual(other.AllowedGrantTypes) ) && ( RedirectUris == other.RedirectUris || RedirectUris != null && other.RedirectUris != null && RedirectUris.SequenceEqual(other.RedirectUris) ) && ( AllowedCorsOrigins == other.AllowedCorsOrigins || AllowedCorsOrigins != null && other.AllowedCorsOrigins != null && AllowedCorsOrigins.SequenceEqual(other.AllowedCorsOrigins) ) && ( PostLogoutRedirectUris == other.PostLogoutRedirectUris || PostLogoutRedirectUris != null && other.PostLogoutRedirectUris != null && PostLogoutRedirectUris.SequenceEqual(other.PostLogoutRedirectUris) ) && ( AllowedScopes == other.AllowedScopes || AllowedScopes != null && other.AllowedScopes != null && AllowedScopes.SequenceEqual(other.AllowedScopes) ) && ( ClientSecrets == other.ClientSecrets || ClientSecrets != null && other.ClientSecrets != null && ClientSecrets.SequenceEqual(other.ClientSecrets) ) && ( HashedClientSecrets == other.HashedClientSecrets || HashedClientSecrets != null && other.HashedClientSecrets != null && HashedClientSecrets.SequenceEqual(other.HashedClientSecrets) ) && ( AllowedOfflineAccess == other.AllowedOfflineAccess || AllowedOfflineAccess.Equals(other.AllowedOfflineAccess) ) && ( AccessTokenLifetime == other.AccessTokenLifetime || AccessTokenLifetime.Equals(other.AccessTokenLifetime) ) && ( IdentityTokenLifetime == other.IdentityTokenLifetime || IdentityTokenLifetime.Equals(other.IdentityTokenLifetime) ) && ( RequireConsent == other.RequireConsent || RequireConsent.Equals(other.RequireConsent) )); }