From 4bac88ee528ba58989a48aef88ff2883f281b913 Mon Sep 17 00:00:00 2001 From: Brady Wied Date: Fri, 20 Dec 2024 16:32:35 -0700 Subject: [PATCH 1/5] 1st pass of "fixes" --- .../fusionauth/client/FusionAuthClient.java | 21 ++++-- .../client/json/WebhookEventDeserializer.java | 74 ------------------- .../java/io/fusionauth/domain/APIVersion.java | 41 ++++++++++ .../java/io/fusionauth/domain/Lambda.java | 16 +++- .../domain/SystemConfiguration.java | 9 ++- .../java/io/fusionauth/domain/Tenant.java | 5 -- .../domain/TenantIdentityConfiguration.java | 58 --------------- .../TenantIdentityConfigurationMode.java | 36 --------- .../java/io/fusionauth/domain/Webhook.java | 9 ++- .../GenericConnectorConfiguration.java | 9 ++- .../domain/event/BaseUserEvent.java | 11 ++- .../fusionauth/domain/event/EventRequest.java | 12 +-- .../domain/event/IdentityVerifiedEvent.java | 2 +- .../event/JWTRefreshTokenRevokeEvent.java | 14 ++-- .../domain/event/UserBulkCreateEvent.java | 6 +- .../domain/event/UserCreateCompleteEvent.java | 2 +- .../domain/event/UserCreateEvent.java | 2 +- .../domain/event/UserDeactivateEvent.java | 2 +- .../domain/event/UserDeleteCompleteEvent.java | 2 +- .../domain/event/UserDeleteEvent.java | 2 +- .../domain/event/UserEmailUpdateEvent.java | 2 +- .../domain/event/UserEmailVerifiedEvent.java | 2 +- .../event/UserIdentityProviderLinkEvent.java | 2 +- .../UserIdentityProviderUnlinkEvent.java | 2 +- .../domain/event/UserLoginFailedEvent.java | 2 +- .../UserLoginIdDuplicateOnCreateEvent.java | 7 +- .../UserLoginIdDuplicateOnUpdateEvent.java | 6 +- .../domain/event/UserLoginNewDeviceEvent.java | 7 +- .../domain/event/UserLoginSuccessEvent.java | 5 +- .../event/UserLoginSuspiciousEvent.java | 2 +- .../domain/event/UserPasswordBreachEvent.java | 2 +- .../event/UserPasswordResetSendEvent.java | 2 +- .../event/UserPasswordResetStartEvent.java | 2 +- .../event/UserPasswordResetSuccessEvent.java | 2 +- .../domain/event/UserPasswordUpdateEvent.java | 2 +- .../domain/event/UserReactivateEvent.java | 2 +- .../UserRegistrationCreateCompleteEvent.java | 2 +- .../event/UserRegistrationCreateEvent.java | 2 +- .../UserRegistrationDeleteCompleteEvent.java | 2 +- .../event/UserRegistrationDeleteEvent.java | 2 +- .../UserRegistrationUpdateCompleteEvent.java | 2 +- .../event/UserRegistrationUpdateEvent.java | 5 +- .../event/UserRegistrationVerifiedEvent.java | 2 +- .../event/UserTwoFactorMethodAddEvent.java | 2 +- .../event/UserTwoFactorMethodRemoveEvent.java | 2 +- .../domain/event/UserUpdateCompleteEvent.java | 4 +- .../domain/event/UserUpdateEvent.java | 4 +- 47 files changed, 168 insertions(+), 243 deletions(-) delete mode 100644 src/main/java/io/fusionauth/client/json/WebhookEventDeserializer.java create mode 100644 src/main/java/io/fusionauth/domain/APIVersion.java delete mode 100644 src/main/java/io/fusionauth/domain/TenantIdentityConfiguration.java delete mode 100644 src/main/java/io/fusionauth/domain/TenantIdentityConfigurationMode.java diff --git a/src/main/java/io/fusionauth/client/FusionAuthClient.java b/src/main/java/io/fusionauth/client/FusionAuthClient.java index 93a81129..a547ac9c 100644 --- a/src/main/java/io/fusionauth/client/FusionAuthClient.java +++ b/src/main/java/io/fusionauth/client/FusionAuthClient.java @@ -34,6 +34,7 @@ import com.inversoft.rest.JSONBodyHandler; import com.inversoft.rest.JSONResponseHandler; import com.inversoft.rest.RESTClient; +import io.fusionauth.domain.APIVersion; import io.fusionauth.domain.LambdaType; import io.fusionauth.domain.OpenIdConfiguration; import io.fusionauth.domain.api.APIKeyRequest; @@ -251,6 +252,7 @@ */ @SuppressWarnings("unused") public class FusionAuthClient { + public static String API_VERSION_HEADER = "X-FusionAuth-API-Version"; public static String TENANT_ID_HEADER = "X-FusionAuth-TenantId"; public static final ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL) @@ -266,6 +268,8 @@ public class FusionAuthClient { private final String apiKey; + public final APIVersion apiVersion; + private final String baseURL; private final ObjectMapper customMapper; @@ -281,19 +285,20 @@ public FusionAuthClient(String apiKey, String baseURL) { } public FusionAuthClient(String apiKey, String baseURL, String tenantId) { - this(apiKey, baseURL, 2000, 2000, tenantId); + this(apiKey, baseURL, 2000, 2000, tenantId, APIVersion.V1); } public FusionAuthClient(String apiKey, String baseURL, int connectTimeout, int readTimeout) { - this(apiKey, baseURL, connectTimeout, readTimeout, null); + this(apiKey, baseURL, connectTimeout, readTimeout, null, APIVersion.V1); } - public FusionAuthClient(String apiKey, String baseURL, int connectTimeout, int readTimeout, String tenantId) { - this(apiKey, baseURL, connectTimeout, readTimeout, tenantId, null); + public FusionAuthClient(String apiKey, String baseURL, int connectTimeout, int readTimeout, String tenantId, APIVersion apiVersion) { + this(apiKey, baseURL, connectTimeout, readTimeout, tenantId, null, apiVersion); } - public FusionAuthClient(String apiKey, String baseURL, int connectTimeout, int readTimeout, String tenantId, ObjectMapper objectMapper) { + public FusionAuthClient(String apiKey, String baseURL, int connectTimeout, int readTimeout, String tenantId, ObjectMapper objectMapper, APIVersion apiVersion) { this.apiKey = apiKey; + this.apiVersion = apiVersion; this.baseURL = baseURL; this.connectTimeout = connectTimeout; this.readTimeout = readTimeout; @@ -315,7 +320,7 @@ public FusionAuthClient setTenantId(UUID tenantId) { return this; } - return new FusionAuthClient(apiKey, baseURL, connectTimeout, readTimeout, tenantId.toString()); + return new FusionAuthClient(apiKey, baseURL, connectTimeout, readTimeout, tenantId.toString(), apiVersion); } /** @@ -326,7 +331,7 @@ public FusionAuthClient setTenantId(UUID tenantId) { * @return the new FusionAuthClient */ public FusionAuthClient setObjectMapper(ObjectMapper objectMapper) { - return new FusionAuthClient(apiKey, baseURL, connectTimeout, readTimeout, tenantId, objectMapper); + return new FusionAuthClient(apiKey, baseURL, connectTimeout, readTimeout, tenantId, objectMapper, apiVersion); } /** @@ -5727,6 +5732,8 @@ protected RESTClient startAnonymous(Class type, Class errorTy client.header(TENANT_ID_HEADER, tenantId); } + client.header(API_VERSION_HEADER, apiVersion.version); + return client; } diff --git a/src/main/java/io/fusionauth/client/json/WebhookEventDeserializer.java b/src/main/java/io/fusionauth/client/json/WebhookEventDeserializer.java deleted file mode 100644 index a52bd8c9..00000000 --- a/src/main/java/io/fusionauth/client/json/WebhookEventDeserializer.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2024, 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.client.json; - -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.util.Arrays; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import io.fusionauth.domain.WebhookEventLog; -import io.fusionauth.domain.event.BaseEvent; -import io.fusionauth.domain.event.EventType; - -/** - * Custom JSON de-serializer for BaseEvent. - * - * @author Spencer Witt - */ -public class WebhookEventDeserializer extends StdDeserializer { - public WebhookEventDeserializer() { - super(WebhookEventLog.class); - } - - @Override - public BaseEvent deserialize(JsonParser p, DeserializationContext ctxt) throws IOException { - JsonNode node = p.getCodec().readTree(p); - - BaseEvent newEvent = extractEventType(ctxt, p, node); - return ((ObjectMapper) p.getCodec()).readerForUpdating(newEvent).readValue(node); - } - - private BaseEvent extractEventType(DeserializationContext ctxt, JsonParser p, JsonNode eventNode) - throws IOException { - JsonNode node = eventNode.at("/type"); - String type = node.asText(); - - EventType eventType = EventType.forValue(type); - if (eventType == null) { - // Handle an unexpected EventType and provide a useful error - String sorted = Arrays.stream(EventType.values()).map(Enum::name).sorted().collect(Collectors.joining(", ")); - return (BaseEvent) ctxt.handleUnexpectedToken(BaseEvent.class, node.asToken(), p, - "Expected the type field to be one of [" + sorted + "], but found [" + node.asText() + "]"); - } - - // Assuming all of our events following this naming schema '{EventType}Event' - String className = BaseEvent.class.getPackage().getName() + "." + eventType.name() + "Event"; - try { - Constructor constructor = Class.forName(className).getDeclaredConstructor(); - // the default constructor for an event can be private - constructor.setAccessible(true); - return (BaseEvent) constructor.newInstance(); - } catch (Exception e) { - throw new IllegalStateException("Unexpected type [" + eventType + "]. This is a FusionAuth bug, could not instantiate class [" + className + "]."); - } - } -} diff --git a/src/main/java/io/fusionauth/domain/APIVersion.java b/src/main/java/io/fusionauth/domain/APIVersion.java new file mode 100644 index 00000000..2008c702 --- /dev/null +++ b/src/main/java/io/fusionauth/domain/APIVersion.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024, 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; + +import java.util.Arrays; +import java.util.Map; +import java.util.stream.Collectors; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum APIVersion { + V1("v1"), + V2("v2"); + + public static final Map allVersions = Arrays.stream(APIVersion.values()) + .collect(Collectors.toMap(v -> v.version, v -> v)); + + @JsonValue + public final String version; + + APIVersion(String version) { + this.version = version; + } + + public boolean greaterThan(APIVersion other) { + return version.compareTo(other.version) > 0; + } +} diff --git a/src/main/java/io/fusionauth/domain/Lambda.java b/src/main/java/io/fusionauth/domain/Lambda.java index 23c2d2a0..6a0bb69c 100644 --- a/src/main/java/io/fusionauth/domain/Lambda.java +++ b/src/main/java/io/fusionauth/domain/Lambda.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, FusionAuth, All Rights Reserved + * Copyright (c) 2019-2024, 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. @@ -16,6 +16,8 @@ package io.fusionauth.domain; import java.time.ZonedDateTime; +import java.util.LinkedHashMap; +import java.util.Map; import java.util.Objects; import java.util.UUID; @@ -29,8 +31,16 @@ * @author Brian Pontarelli */ public class Lambda implements Buildable { + // TODO : ENG-2074 : Brady : Not yet configurable via API + @JsonIgnore + public APIVersion apiVersion = APIVersion.V1; + public String body; + // TODO : ENG-2074 : Brady : Not yet configurable via API + @JsonIgnore + public Map data = new LinkedHashMap<>(); + public boolean debug; /** @@ -59,6 +69,7 @@ public Lambda() { } public Lambda(Lambda lambda) { + this.apiVersion = lambda.apiVersion; this.body = lambda.body; this.name = lambda.name; this.debug = lambda.debug; @@ -80,6 +91,7 @@ public boolean equals(Object o) { } Lambda lambda = (Lambda) o; return debug == lambda.debug && + apiVersion == lambda.apiVersion && enabled == lambda.enabled && Objects.equals(body, lambda.body) && engineType == lambda.engineType && @@ -92,7 +104,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(body, debug, enabled, engineType, id, insertInstant, lastUpdateInstant, name, type); + return Objects.hash(body, apiVersion, debug, enabled, engineType, id, insertInstant, lastUpdateInstant, name, type); } public String toString() { diff --git a/src/main/java/io/fusionauth/domain/SystemConfiguration.java b/src/main/java/io/fusionauth/domain/SystemConfiguration.java index e7def627..0acd335d 100644 --- a/src/main/java/io/fusionauth/domain/SystemConfiguration.java +++ b/src/main/java/io/fusionauth/domain/SystemConfiguration.java @@ -21,6 +21,7 @@ import java.util.Map; import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.inversoft.json.JacksonConstructor; import com.inversoft.json.ToString; @@ -40,6 +41,10 @@ public class SystemConfiguration implements Buildable { public Map data = new HashMap<>(); + // TODO : ENG-2074 : Brady : Not yet configurable via API + @JsonIgnore + public APIVersion defaultAPIVersion = APIVersion.V1; + public EventLogConfiguration eventLogConfiguration = new EventLogConfiguration(); public ZonedDateTime insertInstant; @@ -66,6 +71,7 @@ public SystemConfiguration(SystemConfiguration other) { this.auditLogConfiguration = new AuditLogConfiguration(other.auditLogConfiguration); this.cookieEncryptionKey = other.cookieEncryptionKey; this.corsConfiguration = new CORSConfiguration(other.corsConfiguration); + this.defaultAPIVersion = other.defaultAPIVersion; if (other.data != null) { this.data.putAll(other.data); } @@ -93,6 +99,7 @@ public boolean equals(Object o) { Objects.equals(cookieEncryptionKey, that.cookieEncryptionKey) && Objects.equals(corsConfiguration, that.corsConfiguration) && Objects.equals(data, that.data) && + Objects.equals(defaultAPIVersion, that.defaultAPIVersion) && Objects.equals(eventLogConfiguration, that.eventLogConfiguration) && Objects.equals(insertInstant, that.insertInstant) && Objects.equals(lastUpdateInstant, that.lastUpdateInstant) && @@ -106,7 +113,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(auditLogConfiguration, cookieEncryptionKey, corsConfiguration, data, eventLogConfiguration, insertInstant, lastUpdateInstant, loginRecordConfiguration, reportTimezone, trustedProxyConfiguration, uiConfiguration, usageDataConfiguration, webhookEventLogConfiguration); + return Objects.hash(auditLogConfiguration, cookieEncryptionKey, corsConfiguration, data, defaultAPIVersion, eventLogConfiguration, insertInstant, lastUpdateInstant, loginRecordConfiguration, reportTimezone, trustedProxyConfiguration, uiConfiguration, usageDataConfiguration, webhookEventLogConfiguration); } public void normalize() { diff --git a/src/main/java/io/fusionauth/domain/Tenant.java b/src/main/java/io/fusionauth/domain/Tenant.java index 4012018b..cff6c305 100644 --- a/src/main/java/io/fusionauth/domain/Tenant.java +++ b/src/main/java/io/fusionauth/domain/Tenant.java @@ -71,8 +71,6 @@ public class Tenant implements Buildable { public UUID id; - public TenantIdentityConfiguration identityConfiguration = new TenantIdentityConfiguration(); - public ZonedDateTime insertInstant; public String issuer; @@ -143,7 +141,6 @@ public Tenant(Tenant other) { this.formConfiguration = new TenantFormConfiguration(other.formConfiguration); this.httpSessionMaxInactiveInterval = other.httpSessionMaxInactiveInterval; this.id = other.id; - this.identityConfiguration = new TenantIdentityConfiguration(other.identityConfiguration); this.insertInstant = other.insertInstant; this.accessControlConfiguration = new TenantAccessControlConfiguration(other.accessControlConfiguration); this.issuer = other.issuer; @@ -192,7 +189,6 @@ public boolean equals(Object o) { Objects.equals(familyConfiguration, tenant.familyConfiguration) && Objects.equals(formConfiguration, tenant.formConfiguration) && Objects.equals(id, tenant.id) && - Objects.equals(identityConfiguration, tenant.identityConfiguration) && Objects.equals(insertInstant, tenant.insertInstant) && Objects.equals(accessControlConfiguration, tenant.accessControlConfiguration) && Objects.equals(issuer, tenant.issuer) && @@ -238,7 +234,6 @@ public int hashCode() { formConfiguration, httpSessionMaxInactiveInterval, id, - identityConfiguration, insertInstant, accessControlConfiguration, issuer, diff --git a/src/main/java/io/fusionauth/domain/TenantIdentityConfiguration.java b/src/main/java/io/fusionauth/domain/TenantIdentityConfiguration.java deleted file mode 100644 index 2f321434..00000000 --- a/src/main/java/io/fusionauth/domain/TenantIdentityConfiguration.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2024, 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; - -import java.util.Objects; - -import com.inversoft.json.JacksonConstructor; -import com.inversoft.json.ToString; - -/** - * @author Daniel DeGroff - */ -public class TenantIdentityConfiguration implements Buildable { - public TenantIdentityConfigurationMode mode = TenantIdentityConfigurationMode.Compatible; - - @JacksonConstructor - public TenantIdentityConfiguration() { - } - - public TenantIdentityConfiguration(TenantIdentityConfiguration other) { - this.mode = other.mode; - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - TenantIdentityConfiguration that = (TenantIdentityConfiguration) o; - return mode == that.mode; - } - - @Override - public int hashCode() { - return Objects.hashCode(mode); - } - - @Override - public String toString() { - return ToString.toString(this); - } -} diff --git a/src/main/java/io/fusionauth/domain/TenantIdentityConfigurationMode.java b/src/main/java/io/fusionauth/domain/TenantIdentityConfigurationMode.java deleted file mode 100644 index b7568438..00000000 --- a/src/main/java/io/fusionauth/domain/TenantIdentityConfigurationMode.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2024, 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; - -/** - * @author Daniel DeGroff - */ -public enum TenantIdentityConfigurationMode { - /** - * When operating in compatibility mode you may continue to utilize top level email and username fields and optionally start using discrete - * identities. - *

- * When in this mode, the top level email and username represent the primary email and primary username identities, if defined. - */ - Compatible, - - /** - * When operating in Discrete Identity mode, you may only manage identities in the top level User Identities field. - *

- * When this mode is enabled, you may no longer utilize the top level email and username fields in the User object. - */ - Discrete -} diff --git a/src/main/java/io/fusionauth/domain/Webhook.java b/src/main/java/io/fusionauth/domain/Webhook.java index ff191de3..0a2526f8 100644 --- a/src/main/java/io/fusionauth/domain/Webhook.java +++ b/src/main/java/io/fusionauth/domain/Webhook.java @@ -25,6 +25,7 @@ import java.util.Objects; import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.inversoft.json.JacksonConstructor; import com.inversoft.json.ToString; import io.fusionauth.domain.event.EventType; @@ -36,6 +37,10 @@ * @author Brian Pontarelli */ public class Webhook implements Buildable { + // TODO : ENG-2074 : Brady : Not yet configurable via API + @JsonIgnore + public APIVersion apiVersion = APIVersion.V1; + public Integer connectTimeout; public Map data = new LinkedHashMap<>(); @@ -76,6 +81,7 @@ public Webhook() { } public Webhook(Webhook other) { + this.apiVersion = other.apiVersion; this.connectTimeout = other.connectTimeout; this.data.putAll(other.data); this.description = other.description; @@ -105,6 +111,7 @@ public boolean equals(Object o) { } Webhook webhook = (Webhook) o; return global == webhook.global && + apiVersion == webhook.apiVersion && Objects.equals(connectTimeout, webhook.connectTimeout) && Objects.equals(data, webhook.data) && Objects.equals(description, webhook.description) && Objects.equals(eventsEnabled, webhook.eventsEnabled) && Objects.equals(headers, webhook.headers) && @@ -122,7 +129,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(connectTimeout, data, description, eventsEnabled, global, headers, httpAuthenticationPassword, httpAuthenticationUsername, id, insertInstant, lastUpdateInstant, readTimeout, signatureConfiguration, sslCertificate, sslCertificateKeyId, tenantIds, url); + return Objects.hash(apiVersion, connectTimeout, data, description, eventsEnabled, global, headers, httpAuthenticationPassword, httpAuthenticationUsername, id, insertInstant, lastUpdateInstant, readTimeout, signatureConfiguration, sslCertificate, sslCertificateKeyId, tenantIds, url); } public void normalize() { diff --git a/src/main/java/io/fusionauth/domain/connector/GenericConnectorConfiguration.java b/src/main/java/io/fusionauth/domain/connector/GenericConnectorConfiguration.java index cb5eabe7..2c690b45 100644 --- a/src/main/java/io/fusionauth/domain/connector/GenericConnectorConfiguration.java +++ b/src/main/java/io/fusionauth/domain/connector/GenericConnectorConfiguration.java @@ -19,7 +19,9 @@ import java.util.Objects; import java.util.UUID; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.inversoft.json.ToString; +import io.fusionauth.domain.APIVersion; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.HTTPHeaders; @@ -29,6 +31,10 @@ * @author Trevor Smith */ public class GenericConnectorConfiguration extends BaseConnectorConfiguration implements Buildable { + // TODO : ENG-2074 : Brady : Not yet configurable via API + @JsonIgnore + public APIVersion apiVersion = APIVersion.V1; + public URI authenticationURL; public int connectTimeout; @@ -57,6 +63,7 @@ public boolean equals(Object o) { GenericConnectorConfiguration that = (GenericConnectorConfiguration) o; return connectTimeout == that.connectTimeout && readTimeout == that.readTimeout && + apiVersion == that.apiVersion && Objects.equals(authenticationURL, that.authenticationURL) && Objects.equals(headers, that.headers) && Objects.equals(httpAuthenticationPassword, that.httpAuthenticationPassword) && @@ -71,7 +78,7 @@ public ConnectorType getType() { @Override public int hashCode() { - return Objects.hash(super.hashCode(), authenticationURL, connectTimeout, headers, httpAuthenticationPassword, httpAuthenticationUsername, readTimeout, sslCertificateKeyId); + return Objects.hash(super.hashCode(), authenticationURL, apiVersion, connectTimeout, headers, httpAuthenticationPassword, httpAuthenticationUsername, readTimeout, sslCertificateKeyId); } @Override diff --git a/src/main/java/io/fusionauth/domain/event/BaseUserEvent.java b/src/main/java/io/fusionauth/domain/event/BaseUserEvent.java index 60c211aa..13cc8a6f 100644 --- a/src/main/java/io/fusionauth/domain/event/BaseUserEvent.java +++ b/src/main/java/io/fusionauth/domain/event/BaseUserEvent.java @@ -19,8 +19,8 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; -import io.fusionauth.domain.EventInfo; import io.fusionauth.domain.User; +import io.fusionauth.domain.EventInfo; /** * Base class for all {@link User}-related events. @@ -35,7 +35,10 @@ public BaseUserEvent() { public BaseUserEvent(EventInfo info, User user) { super(info); - this.user = user; + this.user = null; + if (user != null) { + this.user = new User(user).secure().sort(); + } } @Override @@ -64,6 +67,7 @@ public int hashCode() { public static class IdentityInfo { public final String type; + public final String value; @JacksonConstructor @@ -78,7 +82,8 @@ public IdentityInfo(String type, String value) { this.value = value; } - @Override public boolean equals(Object o) { + @Override + public boolean equals(Object o) { if (this == o) { return true; } diff --git a/src/main/java/io/fusionauth/domain/event/EventRequest.java b/src/main/java/io/fusionauth/domain/event/EventRequest.java index 70e2e5b3..cbd727a9 100644 --- a/src/main/java/io/fusionauth/domain/event/EventRequest.java +++ b/src/main/java/io/fusionauth/domain/event/EventRequest.java @@ -17,10 +17,10 @@ import java.util.Objects; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.inversoft.json.JacksonConstructor; import com.inversoft.json.ToString; -import io.fusionauth.client.json.WebhookEventDeserializer; +import io.fusionauth.domain.APIVersion; /** * Container for the event information. This is the JSON that is sent from FusionAuth to webhooks. @@ -28,10 +28,10 @@ * @author Brian Pontarelli */ public class EventRequest { - // TODO : ENG-1822 : Can we delete this if we aren't going to use it an longer? - // Some tests still use it, maybe we should only bind it ot the TestObjectMapper? - // See one usage: UserActionTest.post_noPassword_has_email_and_phone - @JsonDeserialize(using = WebhookEventDeserializer.class) + // this is tracked in the header, only in here to communicate between header<->serializer + @JsonIgnore + public APIVersion apiVersion = APIVersion.V1; + public BaseEvent event; @JacksonConstructor diff --git a/src/main/java/io/fusionauth/domain/event/IdentityVerifiedEvent.java b/src/main/java/io/fusionauth/domain/event/IdentityVerifiedEvent.java index 293077c4..71b22d4b 100644 --- a/src/main/java/io/fusionauth/domain/event/IdentityVerifiedEvent.java +++ b/src/main/java/io/fusionauth/domain/event/IdentityVerifiedEvent.java @@ -19,9 +19,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the identity verified event diff --git a/src/main/java/io/fusionauth/domain/event/JWTRefreshTokenRevokeEvent.java b/src/main/java/io/fusionauth/domain/event/JWTRefreshTokenRevokeEvent.java index aefe4512..73f68d6a 100644 --- a/src/main/java/io/fusionauth/domain/event/JWTRefreshTokenRevokeEvent.java +++ b/src/main/java/io/fusionauth/domain/event/JWTRefreshTokenRevokeEvent.java @@ -23,9 +23,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; import io.fusionauth.domain.jwt.RefreshToken; /** @@ -53,15 +53,19 @@ public JWTRefreshTokenRevokeEvent(EventInfo info, User user, UUID applicationId, super(info); this.applicationId = applicationId; this.applicationTimeToLiveInSeconds.put(applicationId, timeToLiveInSeconds); - this.user = user; - this.userId = user == null ? null : user.id; + if (user != null) { + this.user = new User(user).secure().sort(); + this.userId = user.id; + } } public JWTRefreshTokenRevokeEvent(EventInfo info, User user, Map applicationTimeToLiveInSeconds) { super(info); this.applicationTimeToLiveInSeconds.putAll(applicationTimeToLiveInSeconds); - this.user = user; - this.userId = user == null ? null : user.id; + if (user != null) { + this.user = new User(user).secure().sort(); + this.userId = user.id; + } } public List applicationIds() { diff --git a/src/main/java/io/fusionauth/domain/event/UserBulkCreateEvent.java b/src/main/java/io/fusionauth/domain/event/UserBulkCreateEvent.java index 6d00a316..26915399 100644 --- a/src/main/java/io/fusionauth/domain/event/UserBulkCreateEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserBulkCreateEvent.java @@ -17,11 +17,12 @@ import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Bulk Create Event. @@ -37,7 +38,8 @@ public UserBulkCreateEvent() { public UserBulkCreateEvent(EventInfo info, List users) { super(info); - this.users = users; + this.users = users.stream().map(u -> new User(u).secure().sort()) + .collect(Collectors.toList()); } @Override diff --git a/src/main/java/io/fusionauth/domain/event/UserCreateCompleteEvent.java b/src/main/java/io/fusionauth/domain/event/UserCreateCompleteEvent.java index fe78776f..5c72ca6d 100644 --- a/src/main/java/io/fusionauth/domain/event/UserCreateCompleteEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserCreateCompleteEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Created Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserCreateEvent.java b/src/main/java/io/fusionauth/domain/event/UserCreateEvent.java index e7cd9ff9..21199787 100644 --- a/src/main/java/io/fusionauth/domain/event/UserCreateEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserCreateEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Create Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserDeactivateEvent.java b/src/main/java/io/fusionauth/domain/event/UserDeactivateEvent.java index 7633cf9d..310a0b46 100644 --- a/src/main/java/io/fusionauth/domain/event/UserDeactivateEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserDeactivateEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Deactivate Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserDeleteCompleteEvent.java b/src/main/java/io/fusionauth/domain/event/UserDeleteCompleteEvent.java index b7b9112b..9e2dd704 100644 --- a/src/main/java/io/fusionauth/domain/event/UserDeleteCompleteEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserDeleteCompleteEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Event (and can be converted to JSON) that is used for all user modifications (create, update, diff --git a/src/main/java/io/fusionauth/domain/event/UserDeleteEvent.java b/src/main/java/io/fusionauth/domain/event/UserDeleteEvent.java index e59e839c..1c8fbfcc 100644 --- a/src/main/java/io/fusionauth/domain/event/UserDeleteEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserDeleteEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Event (and can be converted to JSON) that is used for all user modifications (create, update, diff --git a/src/main/java/io/fusionauth/domain/event/UserEmailUpdateEvent.java b/src/main/java/io/fusionauth/domain/event/UserEmailUpdateEvent.java index 9cb9aea0..5e395d6f 100644 --- a/src/main/java/io/fusionauth/domain/event/UserEmailUpdateEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserEmailUpdateEvent.java @@ -18,9 +18,9 @@ import java.util.Objects; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models an event where a user's email is updated outside of a forgot / change password workflow. diff --git a/src/main/java/io/fusionauth/domain/event/UserEmailVerifiedEvent.java b/src/main/java/io/fusionauth/domain/event/UserEmailVerifiedEvent.java index 6cb34914..43b22467 100644 --- a/src/main/java/io/fusionauth/domain/event/UserEmailVerifiedEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserEmailVerifiedEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Email Verify Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserIdentityProviderLinkEvent.java b/src/main/java/io/fusionauth/domain/event/UserIdentityProviderLinkEvent.java index f7e58cfb..43cd5ea3 100644 --- a/src/main/java/io/fusionauth/domain/event/UserIdentityProviderLinkEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserIdentityProviderLinkEvent.java @@ -18,10 +18,10 @@ import java.util.Objects; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; import io.fusionauth.domain.IdentityProviderLink; -import io.fusionauth.domain.User; /** * Models the User Identity Provider Link Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserIdentityProviderUnlinkEvent.java b/src/main/java/io/fusionauth/domain/event/UserIdentityProviderUnlinkEvent.java index 3d9f7e46..09c0250d 100644 --- a/src/main/java/io/fusionauth/domain/event/UserIdentityProviderUnlinkEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserIdentityProviderUnlinkEvent.java @@ -18,10 +18,10 @@ import java.util.Objects; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; import io.fusionauth.domain.IdentityProviderLink; -import io.fusionauth.domain.User; /** * Models the User Identity Provider Unlink Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserLoginFailedEvent.java b/src/main/java/io/fusionauth/domain/event/UserLoginFailedEvent.java index 75813169..81001fd7 100644 --- a/src/main/java/io/fusionauth/domain/event/UserLoginFailedEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserLoginFailedEvent.java @@ -19,9 +19,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; import io.fusionauth.domain.UserLoginFailedReason; import io.fusionauth.domain.UserLoginFailedReasonCode; diff --git a/src/main/java/io/fusionauth/domain/event/UserLoginIdDuplicateOnCreateEvent.java b/src/main/java/io/fusionauth/domain/event/UserLoginIdDuplicateOnCreateEvent.java index 1f054010..e2b20ab2 100644 --- a/src/main/java/io/fusionauth/domain/event/UserLoginIdDuplicateOnCreateEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserLoginIdDuplicateOnCreateEvent.java @@ -19,9 +19,9 @@ import java.util.Objects; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models an event where a user is being created with an "in-use" login Id (email, username, or other identities). @@ -41,12 +41,13 @@ public class UserLoginIdDuplicateOnCreateEvent extends BaseUserEvent implements public UserLoginIdDuplicateOnCreateEvent() { } - public UserLoginIdDuplicateOnCreateEvent(EventInfo info, String duplicateEmail, String duplicateUsername, List duplicateIdentities, User existing, User user) { + public UserLoginIdDuplicateOnCreateEvent(EventInfo info, String duplicateEmail, String duplicateUsername, List duplicateIdentities, + User existing, User user) { super(info, user); this.duplicateEmail = duplicateEmail; this.duplicateUsername = duplicateUsername; this.duplicateIdentities = duplicateIdentities; - this.existing = existing; + this.existing = new User(existing).secure().sort(); } @Override diff --git a/src/main/java/io/fusionauth/domain/event/UserLoginIdDuplicateOnUpdateEvent.java b/src/main/java/io/fusionauth/domain/event/UserLoginIdDuplicateOnUpdateEvent.java index b48ba488..4fa0986d 100644 --- a/src/main/java/io/fusionauth/domain/event/UserLoginIdDuplicateOnUpdateEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserLoginIdDuplicateOnUpdateEvent.java @@ -16,9 +16,10 @@ package io.fusionauth.domain.event; import java.util.List; + import com.inversoft.json.JacksonConstructor; -import io.fusionauth.domain.EventInfo; import io.fusionauth.domain.User; +import io.fusionauth.domain.EventInfo; /** * Models an event where a user is being updated and tries to use an "in-use" login Id (email or username). @@ -30,7 +31,8 @@ public class UserLoginIdDuplicateOnUpdateEvent extends UserLoginIdDuplicateOnCre public UserLoginIdDuplicateOnUpdateEvent() { } - public UserLoginIdDuplicateOnUpdateEvent(EventInfo info, String duplicateEmail, String duplicateUsername, List duplicateIdentities, User existing, User user) { + public UserLoginIdDuplicateOnUpdateEvent(EventInfo info, String duplicateEmail, String duplicateUsername, List duplicateIdentities, + User existing, User user) { super(info, duplicateEmail, duplicateUsername, duplicateIdentities, existing, user); } diff --git a/src/main/java/io/fusionauth/domain/event/UserLoginNewDeviceEvent.java b/src/main/java/io/fusionauth/domain/event/UserLoginNewDeviceEvent.java index 81e646c3..49c1290e 100644 --- a/src/main/java/io/fusionauth/domain/event/UserLoginNewDeviceEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserLoginNewDeviceEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, FusionAuth, All Rights Reserved + * Copyright (c) 2021-2024, 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. @@ -18,8 +18,8 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; -import io.fusionauth.domain.EventInfo; import io.fusionauth.domain.User; +import io.fusionauth.domain.EventInfo; import io.fusionauth.domain.provider.BaseIdentityProvider; /** @@ -33,7 +33,8 @@ public UserLoginNewDeviceEvent() { super(); } - public UserLoginNewDeviceEvent(EventInfo info, UUID applicationId, String authenticationType, BaseIdentityProvider identityProvider, User user) { + public UserLoginNewDeviceEvent(EventInfo info, UUID applicationId, String authenticationType, BaseIdentityProvider identityProvider, + User user) { super(info, applicationId, authenticationType, identityProvider, user); } diff --git a/src/main/java/io/fusionauth/domain/event/UserLoginSuccessEvent.java b/src/main/java/io/fusionauth/domain/event/UserLoginSuccessEvent.java index 8001e3fa..fce489f9 100644 --- a/src/main/java/io/fusionauth/domain/event/UserLoginSuccessEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserLoginSuccessEvent.java @@ -19,9 +19,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; import io.fusionauth.domain.provider.BaseIdentityProvider; import static io.fusionauth.domain.connector.BaseConnectorConfiguration.FUSIONAUTH_CONNECTOR_ID; @@ -49,7 +49,8 @@ public class UserLoginSuccessEvent extends BaseUserEvent implements Buildable identityProvider, User user) { + public UserLoginSuccessEvent(EventInfo info, UUID applicationId, String authenticationType, BaseIdentityProvider identityProvider, + User user) { super(info, user); this.applicationId = applicationId; this.authenticationType = authenticationType; diff --git a/src/main/java/io/fusionauth/domain/event/UserLoginSuspiciousEvent.java b/src/main/java/io/fusionauth/domain/event/UserLoginSuspiciousEvent.java index f2cd8bd0..abe0d53c 100644 --- a/src/main/java/io/fusionauth/domain/event/UserLoginSuspiciousEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserLoginSuspiciousEvent.java @@ -21,9 +21,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.AuthenticationThreats; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; import io.fusionauth.domain.provider.BaseIdentityProvider; /** diff --git a/src/main/java/io/fusionauth/domain/event/UserPasswordBreachEvent.java b/src/main/java/io/fusionauth/domain/event/UserPasswordBreachEvent.java index 5c94adf3..a223f783 100644 --- a/src/main/java/io/fusionauth/domain/event/UserPasswordBreachEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserPasswordBreachEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Password Breach Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserPasswordResetSendEvent.java b/src/main/java/io/fusionauth/domain/event/UserPasswordResetSendEvent.java index bbd178e1..5c9da4fe 100644 --- a/src/main/java/io/fusionauth/domain/event/UserPasswordResetSendEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserPasswordResetSendEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Password Reset Send Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserPasswordResetStartEvent.java b/src/main/java/io/fusionauth/domain/event/UserPasswordResetStartEvent.java index 9eb33033..2088eaac 100644 --- a/src/main/java/io/fusionauth/domain/event/UserPasswordResetStartEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserPasswordResetStartEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Password Reset Start Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserPasswordResetSuccessEvent.java b/src/main/java/io/fusionauth/domain/event/UserPasswordResetSuccessEvent.java index 1dd7a9ec..ab2de2ed 100644 --- a/src/main/java/io/fusionauth/domain/event/UserPasswordResetSuccessEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserPasswordResetSuccessEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Password Reset Success Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserPasswordUpdateEvent.java b/src/main/java/io/fusionauth/domain/event/UserPasswordUpdateEvent.java index c90477ab..670722bd 100644 --- a/src/main/java/io/fusionauth/domain/event/UserPasswordUpdateEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserPasswordUpdateEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Password Update Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserReactivateEvent.java b/src/main/java/io/fusionauth/domain/event/UserReactivateEvent.java index 79ac2ab1..e03eeacc 100644 --- a/src/main/java/io/fusionauth/domain/event/UserReactivateEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserReactivateEvent.java @@ -16,9 +16,9 @@ package io.fusionauth.domain.event; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Reactivate Event. diff --git a/src/main/java/io/fusionauth/domain/event/UserRegistrationCreateCompleteEvent.java b/src/main/java/io/fusionauth/domain/event/UserRegistrationCreateCompleteEvent.java index c64a0e50..da720138 100644 --- a/src/main/java/io/fusionauth/domain/event/UserRegistrationCreateCompleteEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserRegistrationCreateCompleteEvent.java @@ -19,9 +19,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; import io.fusionauth.domain.UserRegistration; /** diff --git a/src/main/java/io/fusionauth/domain/event/UserRegistrationCreateEvent.java b/src/main/java/io/fusionauth/domain/event/UserRegistrationCreateEvent.java index 4b0bead1..96865efa 100644 --- a/src/main/java/io/fusionauth/domain/event/UserRegistrationCreateEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserRegistrationCreateEvent.java @@ -19,9 +19,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; import io.fusionauth.domain.UserRegistration; /** diff --git a/src/main/java/io/fusionauth/domain/event/UserRegistrationDeleteCompleteEvent.java b/src/main/java/io/fusionauth/domain/event/UserRegistrationDeleteCompleteEvent.java index 1398c5e0..d6a0266b 100644 --- a/src/main/java/io/fusionauth/domain/event/UserRegistrationDeleteCompleteEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserRegistrationDeleteCompleteEvent.java @@ -19,9 +19,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; import io.fusionauth.domain.UserRegistration; /** diff --git a/src/main/java/io/fusionauth/domain/event/UserRegistrationDeleteEvent.java b/src/main/java/io/fusionauth/domain/event/UserRegistrationDeleteEvent.java index c3f5bb04..137bfe54 100644 --- a/src/main/java/io/fusionauth/domain/event/UserRegistrationDeleteEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserRegistrationDeleteEvent.java @@ -19,9 +19,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; import io.fusionauth.domain.UserRegistration; /** diff --git a/src/main/java/io/fusionauth/domain/event/UserRegistrationUpdateCompleteEvent.java b/src/main/java/io/fusionauth/domain/event/UserRegistrationUpdateCompleteEvent.java index 67b46f61..073cb89e 100644 --- a/src/main/java/io/fusionauth/domain/event/UserRegistrationUpdateCompleteEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserRegistrationUpdateCompleteEvent.java @@ -19,9 +19,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; import io.fusionauth.domain.UserRegistration; /** diff --git a/src/main/java/io/fusionauth/domain/event/UserRegistrationUpdateEvent.java b/src/main/java/io/fusionauth/domain/event/UserRegistrationUpdateEvent.java index 32aa75bb..abc82247 100644 --- a/src/main/java/io/fusionauth/domain/event/UserRegistrationUpdateEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserRegistrationUpdateEvent.java @@ -19,9 +19,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; import io.fusionauth.domain.UserRegistration; /** @@ -40,7 +40,8 @@ public class UserRegistrationUpdateEvent extends BaseUserEvent implements Builda public UserRegistrationUpdateEvent() { } - public UserRegistrationUpdateEvent(EventInfo info, UUID applicationId, UserRegistration original, UserRegistration registration, User user) { + public UserRegistrationUpdateEvent(EventInfo info, UUID applicationId, UserRegistration original, UserRegistration registration, + User user) { super(info, user); this.applicationId = applicationId; this.original = original; diff --git a/src/main/java/io/fusionauth/domain/event/UserRegistrationVerifiedEvent.java b/src/main/java/io/fusionauth/domain/event/UserRegistrationVerifiedEvent.java index e2190e96..4c1ff442 100644 --- a/src/main/java/io/fusionauth/domain/event/UserRegistrationVerifiedEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserRegistrationVerifiedEvent.java @@ -19,9 +19,9 @@ import java.util.UUID; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; import io.fusionauth.domain.UserRegistration; /** diff --git a/src/main/java/io/fusionauth/domain/event/UserTwoFactorMethodAddEvent.java b/src/main/java/io/fusionauth/domain/event/UserTwoFactorMethodAddEvent.java index 3ef0fd51..39567935 100644 --- a/src/main/java/io/fusionauth/domain/event/UserTwoFactorMethodAddEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserTwoFactorMethodAddEvent.java @@ -18,10 +18,10 @@ import java.util.Objects; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; import io.fusionauth.domain.TwoFactorMethod; -import io.fusionauth.domain.User; /** * Model a user event when a two-factor method has been removed. diff --git a/src/main/java/io/fusionauth/domain/event/UserTwoFactorMethodRemoveEvent.java b/src/main/java/io/fusionauth/domain/event/UserTwoFactorMethodRemoveEvent.java index 8bf2c8d1..2d992bf3 100644 --- a/src/main/java/io/fusionauth/domain/event/UserTwoFactorMethodRemoveEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserTwoFactorMethodRemoveEvent.java @@ -18,10 +18,10 @@ import java.util.Objects; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; import io.fusionauth.domain.TwoFactorMethod; -import io.fusionauth.domain.User; /** * Model a user event when a two-factor method has been added. diff --git a/src/main/java/io/fusionauth/domain/event/UserUpdateCompleteEvent.java b/src/main/java/io/fusionauth/domain/event/UserUpdateCompleteEvent.java index 2b948d9b..a0996ad9 100644 --- a/src/main/java/io/fusionauth/domain/event/UserUpdateCompleteEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserUpdateCompleteEvent.java @@ -18,9 +18,9 @@ import java.util.Objects; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Update Event once it is completed. This cannot be transactional. @@ -36,7 +36,7 @@ public UserUpdateCompleteEvent() { public UserUpdateCompleteEvent(EventInfo info, User original, User user) { super(info, user); - this.original = original; + this.original = new User(original).secure().sort(); } @Override diff --git a/src/main/java/io/fusionauth/domain/event/UserUpdateEvent.java b/src/main/java/io/fusionauth/domain/event/UserUpdateEvent.java index 5f48da32..6cb5ec87 100644 --- a/src/main/java/io/fusionauth/domain/event/UserUpdateEvent.java +++ b/src/main/java/io/fusionauth/domain/event/UserUpdateEvent.java @@ -18,9 +18,9 @@ import java.util.Objects; import com.inversoft.json.JacksonConstructor; +import io.fusionauth.domain.User; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.EventInfo; -import io.fusionauth.domain.User; /** * Models the User Update Event. @@ -36,7 +36,7 @@ public UserUpdateEvent() { public UserUpdateEvent(EventInfo info, User original, User user) { super(info, user); - this.original = original; + this.original = new User(original).secure().sort(); } @Override From 46ffe73d0e31571d91dee5775f124a12050c10ee Mon Sep 17 00:00:00 2001 From: Brady Wied Date: Sat, 21 Dec 2024 09:16:43 -0700 Subject: [PATCH 2/5] Added our missing identity verify API from client builder --- .../fusionauth/client/FusionAuthClient.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/main/java/io/fusionauth/client/FusionAuthClient.java b/src/main/java/io/fusionauth/client/FusionAuthClient.java index a547ac9c..29400425 100644 --- a/src/main/java/io/fusionauth/client/FusionAuthClient.java +++ b/src/main/java/io/fusionauth/client/FusionAuthClient.java @@ -231,6 +231,9 @@ import io.fusionauth.domain.api.user.VerifyEmailResponse; import io.fusionauth.domain.api.user.VerifyRegistrationRequest; import io.fusionauth.domain.api.user.VerifyRegistrationResponse; +import io.fusionauth.domain.api.user.verify.VerifyStartRequest; +import io.fusionauth.domain.api.user.verify.VerifyStartResponse; +import io.fusionauth.domain.api.user.verify.VerifySendCompleteRequest; import io.fusionauth.domain.oauth2.AccessToken; import io.fusionauth.domain.oauth2.DeviceApprovalResponse; import io.fusionauth.domain.oauth2.IntrospectResponse; @@ -545,6 +548,20 @@ public ClientResponse commentOnUser(UserCommentRequ .go(); } + /** + * Completes verification of an identity using verification codes from the Verify Start API. + * + * @param request The identity verify complete request that contains all the information used to verify the identity. + * @return The ClientResponse object. + */ + public ClientResponse completeVerifyIdentity(VerifySendCompleteRequest request) { + return start(Void.TYPE, Errors.class) + .uri("/api/identity/verify/complete") + .bodyHandler(new JSONBodyHandler(request, objectMapper())) + .post() + .go(); + } + /** * Complete a WebAuthn authentication ceremony by validating the signature against the previously generated challenge without logging the user in * @@ -4982,6 +4999,20 @@ public ClientResponse sendTwoFactorCodeForLoginUsingMethod(String .go(); } + /** + * Send a verification code using the appropriate transport for the identity type being verified. + * + * @param request The identity verify send request that contains all the information used send the code. + * @return The ClientResponse object. + */ + public ClientResponse sendVerifyIdentity(VerifySendCompleteRequest request) { + return start(Void.TYPE, Errors.class) + .uri("/api/identity/verify/send") + .bodyHandler(new JSONBodyHandler(request, objectMapper())) + .post() + .go(); + } + /** * Begins a login request for a 3rd party login that requires user interaction such as HYPR. * @@ -5031,6 +5062,21 @@ public ClientResponse startTwoFactorLogin(TwoFac .go(); } + /** + * Start a verification of an identity by generating a code. This code can be sent to the User using the Verify Send API + * Verification Code API or using a mechanism outside of FusionAuth. The verification is completed by using the Verify Complete API with this code. + * + * @param request The identity verify start request that contains all the information used to begin the request. + * @return The ClientResponse object. + */ + public ClientResponse startVerifyIdentity(VerifyStartRequest request) { + return start(VerifyStartResponse.class, Errors.class) + .uri("/api/identity/verify/start") + .bodyHandler(new JSONBodyHandler(request, objectMapper())) + .post() + .go(); + } + /** * Start a WebAuthn authentication ceremony by generating a new challenge for the user * From 769a59eae9b681327e9f168061cd99773cd08dfe Mon Sep 17 00:00:00 2001 From: Brady Wied Date: Sat, 21 Dec 2024 09:25:48 -0700 Subject: [PATCH 3/5] Data was removed from real deal --- src/main/java/io/fusionauth/domain/Lambda.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/io/fusionauth/domain/Lambda.java b/src/main/java/io/fusionauth/domain/Lambda.java index 6a0bb69c..50dde71f 100644 --- a/src/main/java/io/fusionauth/domain/Lambda.java +++ b/src/main/java/io/fusionauth/domain/Lambda.java @@ -16,8 +16,6 @@ package io.fusionauth.domain; import java.time.ZonedDateTime; -import java.util.LinkedHashMap; -import java.util.Map; import java.util.Objects; import java.util.UUID; @@ -37,10 +35,6 @@ public class Lambda implements Buildable { public String body; - // TODO : ENG-2074 : Brady : Not yet configurable via API - @JsonIgnore - public Map data = new LinkedHashMap<>(); - public boolean debug; /** From e4a7e41d5f98776ef527d6ddc277375a4a48757c Mon Sep 17 00:00:00 2001 From: Brady Wied Date: Wed, 15 Jan 2025 15:58:31 -0700 Subject: [PATCH 4/5] api version removal --- .../java/io/fusionauth/domain/APIVersion.java | 41 ------------------- .../java/io/fusionauth/domain/Lambda.java | 10 +---- .../domain/SystemConfiguration.java | 9 +--- .../java/io/fusionauth/domain/Webhook.java | 9 +--- .../GenericConnectorConfiguration.java | 9 +--- .../fusionauth/domain/event/EventRequest.java | 8 +--- 6 files changed, 6 insertions(+), 80 deletions(-) delete mode 100644 src/main/java/io/fusionauth/domain/APIVersion.java diff --git a/src/main/java/io/fusionauth/domain/APIVersion.java b/src/main/java/io/fusionauth/domain/APIVersion.java deleted file mode 100644 index 2008c702..00000000 --- a/src/main/java/io/fusionauth/domain/APIVersion.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2024, 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; - -import java.util.Arrays; -import java.util.Map; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.annotation.JsonValue; - -public enum APIVersion { - V1("v1"), - V2("v2"); - - public static final Map allVersions = Arrays.stream(APIVersion.values()) - .collect(Collectors.toMap(v -> v.version, v -> v)); - - @JsonValue - public final String version; - - APIVersion(String version) { - this.version = version; - } - - public boolean greaterThan(APIVersion other) { - return version.compareTo(other.version) > 0; - } -} diff --git a/src/main/java/io/fusionauth/domain/Lambda.java b/src/main/java/io/fusionauth/domain/Lambda.java index 50dde71f..23c2d2a0 100644 --- a/src/main/java/io/fusionauth/domain/Lambda.java +++ b/src/main/java/io/fusionauth/domain/Lambda.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2024, FusionAuth, All Rights Reserved + * Copyright (c) 2019-2022, 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. @@ -29,10 +29,6 @@ * @author Brian Pontarelli */ public class Lambda implements Buildable { - // TODO : ENG-2074 : Brady : Not yet configurable via API - @JsonIgnore - public APIVersion apiVersion = APIVersion.V1; - public String body; public boolean debug; @@ -63,7 +59,6 @@ public Lambda() { } public Lambda(Lambda lambda) { - this.apiVersion = lambda.apiVersion; this.body = lambda.body; this.name = lambda.name; this.debug = lambda.debug; @@ -85,7 +80,6 @@ public boolean equals(Object o) { } Lambda lambda = (Lambda) o; return debug == lambda.debug && - apiVersion == lambda.apiVersion && enabled == lambda.enabled && Objects.equals(body, lambda.body) && engineType == lambda.engineType && @@ -98,7 +92,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(body, apiVersion, debug, enabled, engineType, id, insertInstant, lastUpdateInstant, name, type); + return Objects.hash(body, debug, enabled, engineType, id, insertInstant, lastUpdateInstant, name, type); } public String toString() { diff --git a/src/main/java/io/fusionauth/domain/SystemConfiguration.java b/src/main/java/io/fusionauth/domain/SystemConfiguration.java index 0acd335d..e7def627 100644 --- a/src/main/java/io/fusionauth/domain/SystemConfiguration.java +++ b/src/main/java/io/fusionauth/domain/SystemConfiguration.java @@ -21,7 +21,6 @@ import java.util.Map; import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.inversoft.json.JacksonConstructor; import com.inversoft.json.ToString; @@ -41,10 +40,6 @@ public class SystemConfiguration implements Buildable { public Map data = new HashMap<>(); - // TODO : ENG-2074 : Brady : Not yet configurable via API - @JsonIgnore - public APIVersion defaultAPIVersion = APIVersion.V1; - public EventLogConfiguration eventLogConfiguration = new EventLogConfiguration(); public ZonedDateTime insertInstant; @@ -71,7 +66,6 @@ public SystemConfiguration(SystemConfiguration other) { this.auditLogConfiguration = new AuditLogConfiguration(other.auditLogConfiguration); this.cookieEncryptionKey = other.cookieEncryptionKey; this.corsConfiguration = new CORSConfiguration(other.corsConfiguration); - this.defaultAPIVersion = other.defaultAPIVersion; if (other.data != null) { this.data.putAll(other.data); } @@ -99,7 +93,6 @@ public boolean equals(Object o) { Objects.equals(cookieEncryptionKey, that.cookieEncryptionKey) && Objects.equals(corsConfiguration, that.corsConfiguration) && Objects.equals(data, that.data) && - Objects.equals(defaultAPIVersion, that.defaultAPIVersion) && Objects.equals(eventLogConfiguration, that.eventLogConfiguration) && Objects.equals(insertInstant, that.insertInstant) && Objects.equals(lastUpdateInstant, that.lastUpdateInstant) && @@ -113,7 +106,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(auditLogConfiguration, cookieEncryptionKey, corsConfiguration, data, defaultAPIVersion, eventLogConfiguration, insertInstant, lastUpdateInstant, loginRecordConfiguration, reportTimezone, trustedProxyConfiguration, uiConfiguration, usageDataConfiguration, webhookEventLogConfiguration); + return Objects.hash(auditLogConfiguration, cookieEncryptionKey, corsConfiguration, data, eventLogConfiguration, insertInstant, lastUpdateInstant, loginRecordConfiguration, reportTimezone, trustedProxyConfiguration, uiConfiguration, usageDataConfiguration, webhookEventLogConfiguration); } public void normalize() { diff --git a/src/main/java/io/fusionauth/domain/Webhook.java b/src/main/java/io/fusionauth/domain/Webhook.java index 0a2526f8..ff191de3 100644 --- a/src/main/java/io/fusionauth/domain/Webhook.java +++ b/src/main/java/io/fusionauth/domain/Webhook.java @@ -25,7 +25,6 @@ import java.util.Objects; import java.util.UUID; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.inversoft.json.JacksonConstructor; import com.inversoft.json.ToString; import io.fusionauth.domain.event.EventType; @@ -37,10 +36,6 @@ * @author Brian Pontarelli */ public class Webhook implements Buildable { - // TODO : ENG-2074 : Brady : Not yet configurable via API - @JsonIgnore - public APIVersion apiVersion = APIVersion.V1; - public Integer connectTimeout; public Map data = new LinkedHashMap<>(); @@ -81,7 +76,6 @@ public Webhook() { } public Webhook(Webhook other) { - this.apiVersion = other.apiVersion; this.connectTimeout = other.connectTimeout; this.data.putAll(other.data); this.description = other.description; @@ -111,7 +105,6 @@ public boolean equals(Object o) { } Webhook webhook = (Webhook) o; return global == webhook.global && - apiVersion == webhook.apiVersion && Objects.equals(connectTimeout, webhook.connectTimeout) && Objects.equals(data, webhook.data) && Objects.equals(description, webhook.description) && Objects.equals(eventsEnabled, webhook.eventsEnabled) && Objects.equals(headers, webhook.headers) && @@ -129,7 +122,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(apiVersion, connectTimeout, data, description, eventsEnabled, global, headers, httpAuthenticationPassword, httpAuthenticationUsername, id, insertInstant, lastUpdateInstant, readTimeout, signatureConfiguration, sslCertificate, sslCertificateKeyId, tenantIds, url); + return Objects.hash(connectTimeout, data, description, eventsEnabled, global, headers, httpAuthenticationPassword, httpAuthenticationUsername, id, insertInstant, lastUpdateInstant, readTimeout, signatureConfiguration, sslCertificate, sslCertificateKeyId, tenantIds, url); } public void normalize() { diff --git a/src/main/java/io/fusionauth/domain/connector/GenericConnectorConfiguration.java b/src/main/java/io/fusionauth/domain/connector/GenericConnectorConfiguration.java index 2c690b45..cb5eabe7 100644 --- a/src/main/java/io/fusionauth/domain/connector/GenericConnectorConfiguration.java +++ b/src/main/java/io/fusionauth/domain/connector/GenericConnectorConfiguration.java @@ -19,9 +19,7 @@ import java.util.Objects; import java.util.UUID; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.inversoft.json.ToString; -import io.fusionauth.domain.APIVersion; import io.fusionauth.domain.Buildable; import io.fusionauth.domain.HTTPHeaders; @@ -31,10 +29,6 @@ * @author Trevor Smith */ public class GenericConnectorConfiguration extends BaseConnectorConfiguration implements Buildable { - // TODO : ENG-2074 : Brady : Not yet configurable via API - @JsonIgnore - public APIVersion apiVersion = APIVersion.V1; - public URI authenticationURL; public int connectTimeout; @@ -63,7 +57,6 @@ public boolean equals(Object o) { GenericConnectorConfiguration that = (GenericConnectorConfiguration) o; return connectTimeout == that.connectTimeout && readTimeout == that.readTimeout && - apiVersion == that.apiVersion && Objects.equals(authenticationURL, that.authenticationURL) && Objects.equals(headers, that.headers) && Objects.equals(httpAuthenticationPassword, that.httpAuthenticationPassword) && @@ -78,7 +71,7 @@ public ConnectorType getType() { @Override public int hashCode() { - return Objects.hash(super.hashCode(), authenticationURL, apiVersion, connectTimeout, headers, httpAuthenticationPassword, httpAuthenticationUsername, readTimeout, sslCertificateKeyId); + return Objects.hash(super.hashCode(), authenticationURL, connectTimeout, headers, httpAuthenticationPassword, httpAuthenticationUsername, readTimeout, sslCertificateKeyId); } @Override diff --git a/src/main/java/io/fusionauth/domain/event/EventRequest.java b/src/main/java/io/fusionauth/domain/event/EventRequest.java index cbd727a9..da89a540 100644 --- a/src/main/java/io/fusionauth/domain/event/EventRequest.java +++ b/src/main/java/io/fusionauth/domain/event/EventRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2024, FusionAuth, All Rights Reserved + * Copyright (c) 2018-2025, 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. @@ -17,10 +17,8 @@ import java.util.Objects; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.inversoft.json.JacksonConstructor; import com.inversoft.json.ToString; -import io.fusionauth.domain.APIVersion; /** * Container for the event information. This is the JSON that is sent from FusionAuth to webhooks. @@ -28,10 +26,6 @@ * @author Brian Pontarelli */ public class EventRequest { - // this is tracked in the header, only in here to communicate between header<->serializer - @JsonIgnore - public APIVersion apiVersion = APIVersion.V1; - public BaseEvent event; @JacksonConstructor From 62e7c2e9a97323a5d043fa5f3f7f6392d59686cd Mon Sep 17 00:00:00 2001 From: Brady Wied Date: Wed, 15 Jan 2025 16:03:00 -0700 Subject: [PATCH 5/5] Updates from client builder --- .../fusionauth/client/FusionAuthClient.java | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/main/java/io/fusionauth/client/FusionAuthClient.java b/src/main/java/io/fusionauth/client/FusionAuthClient.java index 29400425..a7db9073 100644 --- a/src/main/java/io/fusionauth/client/FusionAuthClient.java +++ b/src/main/java/io/fusionauth/client/FusionAuthClient.java @@ -34,7 +34,6 @@ import com.inversoft.rest.JSONBodyHandler; import com.inversoft.rest.JSONResponseHandler; import com.inversoft.rest.RESTClient; -import io.fusionauth.domain.APIVersion; import io.fusionauth.domain.LambdaType; import io.fusionauth.domain.OpenIdConfiguration; import io.fusionauth.domain.api.APIKeyRequest; @@ -255,7 +254,6 @@ */ @SuppressWarnings("unused") public class FusionAuthClient { - public static String API_VERSION_HEADER = "X-FusionAuth-API-Version"; public static String TENANT_ID_HEADER = "X-FusionAuth-TenantId"; public static final ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL) @@ -271,8 +269,6 @@ public class FusionAuthClient { private final String apiKey; - public final APIVersion apiVersion; - private final String baseURL; private final ObjectMapper customMapper; @@ -288,20 +284,19 @@ public FusionAuthClient(String apiKey, String baseURL) { } public FusionAuthClient(String apiKey, String baseURL, String tenantId) { - this(apiKey, baseURL, 2000, 2000, tenantId, APIVersion.V1); + this(apiKey, baseURL, 2000, 2000, tenantId); } public FusionAuthClient(String apiKey, String baseURL, int connectTimeout, int readTimeout) { - this(apiKey, baseURL, connectTimeout, readTimeout, null, APIVersion.V1); + this(apiKey, baseURL, connectTimeout, readTimeout, null); } - public FusionAuthClient(String apiKey, String baseURL, int connectTimeout, int readTimeout, String tenantId, APIVersion apiVersion) { - this(apiKey, baseURL, connectTimeout, readTimeout, tenantId, null, apiVersion); + public FusionAuthClient(String apiKey, String baseURL, int connectTimeout, int readTimeout, String tenantId) { + this(apiKey, baseURL, connectTimeout, readTimeout, tenantId, null); } - public FusionAuthClient(String apiKey, String baseURL, int connectTimeout, int readTimeout, String tenantId, ObjectMapper objectMapper, APIVersion apiVersion) { + public FusionAuthClient(String apiKey, String baseURL, int connectTimeout, int readTimeout, String tenantId, ObjectMapper objectMapper) { this.apiKey = apiKey; - this.apiVersion = apiVersion; this.baseURL = baseURL; this.connectTimeout = connectTimeout; this.readTimeout = readTimeout; @@ -323,7 +318,7 @@ public FusionAuthClient setTenantId(UUID tenantId) { return this; } - return new FusionAuthClient(apiKey, baseURL, connectTimeout, readTimeout, tenantId.toString(), apiVersion); + return new FusionAuthClient(apiKey, baseURL, connectTimeout, readTimeout, tenantId.toString()); } /** @@ -334,7 +329,7 @@ public FusionAuthClient setTenantId(UUID tenantId) { * @return the new FusionAuthClient */ public FusionAuthClient setObjectMapper(ObjectMapper objectMapper) { - return new FusionAuthClient(apiKey, baseURL, connectTimeout, readTimeout, tenantId, objectMapper, apiVersion); + return new FusionAuthClient(apiKey, baseURL, connectTimeout, readTimeout, tenantId, objectMapper); } /** @@ -5778,8 +5773,6 @@ protected RESTClient startAnonymous(Class type, Class errorTy client.header(TENANT_ID_HEADER, tenantId); } - client.header(API_VERSION_HEADER, apiVersion.version); - return client; }