diff --git a/src/main/java/io/fusionauth/client/FusionAuthClient.java b/src/main/java/io/fusionauth/client/FusionAuthClient.java index bb8062cfd..94496fd97 100644 --- a/src/main/java/io/fusionauth/client/FusionAuthClient.java +++ b/src/main/java/io/fusionauth/client/FusionAuthClient.java @@ -212,6 +212,8 @@ import io.fusionauth.domain.api.report.MonthlyActiveUserReportResponse; import io.fusionauth.domain.api.report.RegistrationReportResponse; import io.fusionauth.domain.api.report.TotalsReportResponse; +import io.fusionauth.domain.api.tenantManager.TenantManagerIdentityProviderTypeConfigurationRequest; +import io.fusionauth.domain.api.tenantManager.TenantManagerIdentityProviderTypeConfigurationResponse; import io.fusionauth.domain.api.twoFactor.SecretResponse; import io.fusionauth.domain.api.twoFactor.TwoFactorLoginRequest; import io.fusionauth.domain.api.twoFactor.TwoFactorSendRequest; @@ -1167,6 +1169,22 @@ public ClientResponse createTenant(UUID tenantId, Tenant .go(); } + /** + * Creates a tenant manager identity provider type configuration for the given identity provider type. + * + * @param type The type of the identity provider. + * @param request The request object that contains all the information used to create the tenant manager identity provider type configuration. + * @return The ClientResponse object. + */ + public ClientResponse createTenantManagerIdentityProviderTypeConfiguration(IdentityProviderType type, TenantManagerIdentityProviderTypeConfigurationRequest request) { + return start(TenantManagerIdentityProviderTypeConfigurationResponse.class, Errors.class) + .uri("/api/tenant-manager/identity-provider") + .urlSegment(type) + .bodyHandler(new JSONBodyHandler(request, objectMapper())) + .post() + .go(); + } + /** * Creates a Theme. You can optionally specify an Id for the theme, if not provided one will be generated. * @@ -1747,6 +1765,20 @@ public ClientResponse deleteTenantAsync(UUID tenantId) { .go(); } + /** + * Deletes the tenant manager identity provider type configuration for the given identity provider type. + * + * @param type The type of the identity provider. + * @return The ClientResponse object. + */ + public ClientResponse deleteTenantManagerIdentityProviderTypeConfiguration(IdentityProviderType type) { + return start(Void.TYPE, Errors.class) + .uri("/api/tenant-manager/identity-provider") + .urlSegment(type) + .delete() + .go(); + } + /** * Deletes the tenant based on the given request (sent to the API as JSON). This permanently deletes all information, metrics, reports and data associated * with the tenant and everything under the tenant (applications, users, etc). @@ -3016,6 +3048,22 @@ public ClientResponse patchTenant(UUID tenantId, Map patchTenantManagerIdentityProviderTypeConfiguration(IdentityProviderType type, Map request) { + return start(TenantManagerIdentityProviderTypeConfigurationResponse.class, Errors.class) + .uri("/api/tenant-manager/identity-provider") + .urlSegment(type) + .bodyHandler(new JSONBodyHandler(request, objectMapper())) + .patch() + .go(); + } + /** * Updates, via PATCH, the theme with the given Id. * @@ -6106,6 +6154,22 @@ public ClientResponse updateTenant(UUID tenantId, Tenant .go(); } + /** + * Updates the tenant manager identity provider type configuration for the given identity provider type. + * + * @param type The type of the identity provider. + * @param request The request object that contains the updated tenant manager identity provider type configuration. + * @return The ClientResponse object. + */ + public ClientResponse updateTenantManagerIdentityProviderTypeConfiguration(IdentityProviderType type, TenantManagerIdentityProviderTypeConfigurationRequest request) { + return start(TenantManagerIdentityProviderTypeConfigurationResponse.class, Errors.class) + .uri("/api/tenant-manager/identity-provider") + .urlSegment(type) + .bodyHandler(new JSONBodyHandler(request, objectMapper())) + .put() + .go(); + } + /** * Updates the theme with the given Id. * diff --git a/src/main/java/io/fusionauth/domain/SystemConfiguration.java b/src/main/java/io/fusionauth/domain/SystemConfiguration.java index bd94d3975..64033219d 100644 --- a/src/main/java/io/fusionauth/domain/SystemConfiguration.java +++ b/src/main/java/io/fusionauth/domain/SystemConfiguration.java @@ -24,6 +24,7 @@ import com.inversoft.json.JacksonConstructor; import com.inversoft.json.ToString; +import io.fusionauth.domain.tenantManager.TenantManagerIdentityProviderTypeConfiguration; /** * @author Brian Pontarelli @@ -292,13 +293,16 @@ public static class TenantManagerConfiguration implements Buildable identityProviderTypeConfigurations = new HashMap<>(); + @JacksonConstructor public TenantManagerConfiguration() { } public TenantManagerConfiguration(TenantManagerConfiguration other) { - this.brandName = other.brandName; this.attributeFormId = other.attributeFormId; + this.brandName = other.brandName; + this.identityProviderTypeConfigurations.putAll(other.identityProviderTypeConfigurations); } @Override @@ -310,13 +314,14 @@ public boolean equals(Object o) { return false; } TenantManagerConfiguration that = (TenantManagerConfiguration) o; - return Objects.equals(brandName, that.brandName) && - Objects.equals(attributeFormId, that.attributeFormId); + return Objects.equals(attributeFormId, that.attributeFormId) && + Objects.equals(brandName, that.brandName) && + Objects.equals(identityProviderTypeConfigurations, that.identityProviderTypeConfigurations); } @Override public int hashCode() { - return Objects.hash(brandName, attributeFormId); + return Objects.hash(attributeFormId, brandName, identityProviderTypeConfigurations); } @Override diff --git a/src/main/java/io/fusionauth/domain/api/tenantManager/TenantManagerIdentityProviderTypeConfigurationRequest.java b/src/main/java/io/fusionauth/domain/api/tenantManager/TenantManagerIdentityProviderTypeConfigurationRequest.java new file mode 100644 index 000000000..1eee837ea --- /dev/null +++ b/src/main/java/io/fusionauth/domain/api/tenantManager/TenantManagerIdentityProviderTypeConfigurationRequest.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2026, FusionAuth, All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + */ +package io.fusionauth.domain.api.tenantManager; + +import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.tenantManager.TenantManagerIdentityProviderTypeConfiguration; + +/** + * The Tenant Manager IdP type configuration request object + */ +public class TenantManagerIdentityProviderTypeConfigurationRequest { + public TenantManagerIdentityProviderTypeConfiguration typeConfiguration; + + @JacksonConstructor + public TenantManagerIdentityProviderTypeConfigurationRequest() { + } +} diff --git a/src/main/java/io/fusionauth/domain/api/tenantManager/TenantManagerIdentityProviderTypeConfigurationResponse.java b/src/main/java/io/fusionauth/domain/api/tenantManager/TenantManagerIdentityProviderTypeConfigurationResponse.java new file mode 100644 index 000000000..5734e1364 --- /dev/null +++ b/src/main/java/io/fusionauth/domain/api/tenantManager/TenantManagerIdentityProviderTypeConfigurationResponse.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2026, FusionAuth, All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + */ +package io.fusionauth.domain.api.tenantManager; + +import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.tenantManager.TenantManagerIdentityProviderTypeConfiguration; + +/** + * The Tenant Manager IdP type configuration response object + */ +public class TenantManagerIdentityProviderTypeConfigurationResponse { + public TenantManagerIdentityProviderTypeConfiguration typeConfiguration; + + @JacksonConstructor + public TenantManagerIdentityProviderTypeConfigurationResponse() { + } + + public TenantManagerIdentityProviderTypeConfigurationResponse(TenantManagerIdentityProviderTypeConfiguration typeConfiguration) { + this.typeConfiguration = typeConfiguration; + } +} diff --git a/src/main/java/io/fusionauth/domain/tenantManager/TenantManagerIdentityProviderTypeConfiguration.java b/src/main/java/io/fusionauth/domain/tenantManager/TenantManagerIdentityProviderTypeConfiguration.java new file mode 100644 index 000000000..0a81a3bfd --- /dev/null +++ b/src/main/java/io/fusionauth/domain/tenantManager/TenantManagerIdentityProviderTypeConfiguration.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2026, FusionAuth, All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the License. + */ +package io.fusionauth.domain.tenantManager; + +import java.time.ZonedDateTime; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.inversoft.json.JacksonConstructor; +import com.inversoft.json.ToString; +import io.fusionauth.domain.Buildable; +import io.fusionauth.domain.Enableable; +import io.fusionauth.domain.provider.IdentityProviderLinkingStrategy; +import io.fusionauth.domain.provider.IdentityProviderType; + +/** + * Configuration object for identity provider types allowed in Tenant Manager + */ +public class TenantManagerIdentityProviderTypeConfiguration extends Enableable implements Buildable { + @JsonIgnore + public Map data = new LinkedHashMap<>(); + + public Map defaultAttributeMappings = new HashMap<>(); + + public ZonedDateTime insertInstant; + + public ZonedDateTime lastUpdateInstant; + + public IdentityProviderLinkingStrategy linkingStrategy; + + public IdentityProviderType type; + + @JacksonConstructor + public TenantManagerIdentityProviderTypeConfiguration() { + } + + public TenantManagerIdentityProviderTypeConfiguration(TenantManagerIdentityProviderTypeConfiguration other) { + this.data.putAll(other.data); + this.defaultAttributeMappings.putAll(other.defaultAttributeMappings); + this.insertInstant = other.insertInstant; + this.lastUpdateInstant = other.lastUpdateInstant; + this.linkingStrategy = other.linkingStrategy; + this.type = other.type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + TenantManagerIdentityProviderTypeConfiguration that = (TenantManagerIdentityProviderTypeConfiguration) o; + return Objects.equals(defaultAttributeMappings, that.defaultAttributeMappings) && + Objects.equals(insertInstant, that.insertInstant) && + Objects.equals(lastUpdateInstant, that.lastUpdateInstant) && + linkingStrategy == that.linkingStrategy && + type == that.type; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), defaultAttributeMappings, insertInstant, lastUpdateInstant, linkingStrategy, type); + } + + @Override + public String toString() { + return ToString.toString(this); + } +}