Skip to content

Commit

Permalink
Client sync
Browse files Browse the repository at this point in the history
  • Loading branch information
robotdan committed Sep 3, 2024
1 parent 34acaf0 commit 70ee6bf
Show file tree
Hide file tree
Showing 60 changed files with 813 additions and 1,224 deletions.
46 changes: 46 additions & 0 deletions src/main/java/io/fusionauth/client/FusionAuthClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@
import io.fusionauth.domain.api.WebAuthnRegisterStartResponse;
import io.fusionauth.domain.api.WebAuthnStartRequest;
import io.fusionauth.domain.api.WebAuthnStartResponse;
import io.fusionauth.domain.api.WebhookAttemptLogResponse;
import io.fusionauth.domain.api.WebhookEventLogResponse;
import io.fusionauth.domain.api.WebhookEventLogSearchRequest;
import io.fusionauth.domain.api.WebhookEventLogSearchResponse;
import io.fusionauth.domain.api.WebhookRequest;
import io.fusionauth.domain.api.WebhookResponse;
import io.fusionauth.domain.api.WebhookSearchRequest;
Expand Down Expand Up @@ -4326,6 +4330,34 @@ public ClientResponse<WebhookResponse, Void> retrieveWebhook(UUID webhookId) {
.go();
}

/**
* Retrieves a single webhook attempt log for the given Id.
*
* @param webhookAttemptLogId The Id of the webhook attempt log to retrieve.
* @return The ClientResponse object.
*/
public ClientResponse<WebhookAttemptLogResponse, Errors> retrieveWebhookAttemptLog(UUID webhookAttemptLogId) {
return start(WebhookAttemptLogResponse.class, Errors.class)
.uri("/api/system/webhook-attempt-log")
.urlSegment(webhookAttemptLogId)
.get()
.go();
}

/**
* Retrieves a single webhook event log for the given Id.
*
* @param webhookEventLogId The Id of the webhook event log to retrieve.
* @return The ClientResponse object.
*/
public ClientResponse<WebhookEventLogResponse, Errors> retrieveWebhookEventLog(UUID webhookEventLogId) {
return start(WebhookEventLogResponse.class, Errors.class)
.uri("/api/system/webhook-event-log")
.urlSegment(webhookEventLogId)
.get()
.go();
}

/**
* Retrieves all the webhooks.
*
Expand Down Expand Up @@ -4808,6 +4840,20 @@ public ClientResponse<SearchResponse, Errors> searchUsersByQueryString(SearchReq
.go();
}

/**
* Searches the webhook event logs with the specified criteria and pagination.
*
* @param request The search criteria and pagination information.
* @return The ClientResponse object.
*/
public ClientResponse<WebhookEventLogSearchResponse, Errors> searchWebhookEventLogs(WebhookEventLogSearchRequest request) {
return start(WebhookEventLogSearchResponse.class, Errors.class)
.uri("/api/system/webhook-event-log/search")
.bodyHandler(new JSONBodyHandler(request, objectMapper()))
.post()
.go();
}

/**
* Searches webhooks with the specified criteria and pagination.
*
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class ExternalIdentifierConfiguration implements Buildable<ExternalIdenti

public int externalAuthenticationIdTimeToLiveInSeconds = 300;

public int loginIntentTimeToLiveInSeconds = 1800;

public int oneTimePasswordTimeToLiveInSeconds = 60;

public SecureGeneratorConfiguration passwordlessLoginGenerator = new SecureGeneratorConfiguration(32, SecureGeneratorType.randomBytes);
Expand Down Expand Up @@ -92,6 +94,7 @@ public ExternalIdentifierConfiguration(ExternalIdentifierConfiguration other) {
this.emailVerificationIdTimeToLiveInSeconds = other.emailVerificationIdTimeToLiveInSeconds;
this.emailVerificationOneTimeCodeGenerator = new SecureGeneratorConfiguration(other.emailVerificationOneTimeCodeGenerator);
this.externalAuthenticationIdTimeToLiveInSeconds = other.externalAuthenticationIdTimeToLiveInSeconds;
this.loginIntentTimeToLiveInSeconds = other.loginIntentTimeToLiveInSeconds;
this.oneTimePasswordTimeToLiveInSeconds = other.oneTimePasswordTimeToLiveInSeconds;
this.passwordlessLoginTimeToLiveInSeconds = other.passwordlessLoginTimeToLiveInSeconds;
this.passwordlessLoginGenerator = new SecureGeneratorConfiguration(other.passwordlessLoginGenerator);
Expand Down Expand Up @@ -126,6 +129,7 @@ public boolean equals(Object o) {
deviceCodeTimeToLiveInSeconds == that.deviceCodeTimeToLiveInSeconds &&
emailVerificationIdTimeToLiveInSeconds == that.emailVerificationIdTimeToLiveInSeconds &&
externalAuthenticationIdTimeToLiveInSeconds == that.externalAuthenticationIdTimeToLiveInSeconds &&
loginIntentTimeToLiveInSeconds == that.loginIntentTimeToLiveInSeconds &&
oneTimePasswordTimeToLiveInSeconds == that.oneTimePasswordTimeToLiveInSeconds &&
passwordlessLoginTimeToLiveInSeconds == that.passwordlessLoginTimeToLiveInSeconds &&
pendingAccountLinkTimeToLiveInSeconds == that.pendingAccountLinkTimeToLiveInSeconds &&
Expand Down Expand Up @@ -161,6 +165,7 @@ public int hashCode() {
emailVerificationIdTimeToLiveInSeconds,
emailVerificationOneTimeCodeGenerator,
externalAuthenticationIdTimeToLiveInSeconds,
loginIntentTimeToLiveInSeconds,
oneTimePasswordTimeToLiveInSeconds,
passwordlessLoginGenerator,
passwordlessLoginTimeToLiveInSeconds,
Expand All @@ -185,4 +190,4 @@ public int hashCode() {
public String toString() {
return ToString.toString(this);
}
}
}
30 changes: 28 additions & 2 deletions src/main/java/io/fusionauth/domain/LambdaType.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @author Brian Pontarelli
*/
@SuppressWarnings("JSUnusedLocalSymbols")
@SuppressWarnings("ALL")
public enum LambdaType {
// @formatter:off
JWTPopulate("populate", "" +
Expand Down Expand Up @@ -470,7 +470,33 @@ public enum LambdaType {
"\n" +
" console.info('Hello World!');" +
"\n" +
"}\n");
"}\n"),

LoginValidation("validate", "" +
//language=JavaScript
"// Validate the login request by optionally setting errors in the result.\n" +
"function validate(result, user, registration, context) {\n" +
" // Use the provided user, registration and context arguments to perform additional validation.\n" +
" // - To fail a login request, add one or more field or general errors to the result.\n" +
" // The error schema can be found in the FusionAuth API documentation.\n" +
" // - https://fusionauth.io/docs/apis/errors\n" +
" // \n"+
" // Below is an example validation that will reject a login request when an email domain is\n" +
" // equal to acme.com and the authentication type is not PASSWORD.\n"+
" // \n"+
" // if (user.email && user.email.endsWith(\"@acme.com\") && context.authenticationType !== \"PASSWORD\") {\n"+
" // result.errors.generalErrors = [{\n"+
" // code: \"[LoginRestricted]\",\n" +
" // message: \"Your account is restricted.\"\n" +
" // }];\n"+
" // }\n"+
" // \n"+
"\n" +
" // Happy coding! Populate your login validation lambda here.\n" +
"\n" +
" console.info('Hello World!');" +
"\n" +
"}\n");
// @formatter:on

private final String example;
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/io/fusionauth/domain/SystemConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class SystemConfiguration implements Buildable<SystemConfiguration> {

public UIConfiguration uiConfiguration = new UIConfiguration();

public WebhookEventLogConfiguration webhookEventLogConfiguration = new WebhookEventLogConfiguration();

@JacksonConstructor
public SystemConfiguration() {
}
Expand All @@ -72,6 +74,7 @@ public SystemConfiguration(SystemConfiguration other) {
this.reportTimezone = other.reportTimezone;
this.trustedProxyConfiguration = new SystemTrustedProxyConfiguration(other.trustedProxyConfiguration);
this.uiConfiguration = new UIConfiguration(other.uiConfiguration);
this.webhookEventLogConfiguration = new WebhookEventLogConfiguration(other.webhookEventLogConfiguration);
}

@Override
Expand All @@ -93,12 +96,13 @@ public boolean equals(Object o) {
Objects.equals(loginRecordConfiguration, that.loginRecordConfiguration) &&
Objects.equals(trustedProxyConfiguration, that.trustedProxyConfiguration) &&
Objects.equals(reportTimezone, that.reportTimezone) &&
Objects.equals(uiConfiguration, that.uiConfiguration);
Objects.equals(uiConfiguration, that.uiConfiguration) &&
Objects.equals(webhookEventLogConfiguration, that.webhookEventLogConfiguration);
}

@Override
public int hashCode() {
return Objects.hash(auditLogConfiguration, cookieEncryptionKey, corsConfiguration, data, eventLogConfiguration, insertInstant, lastUpdateInstant, loginRecordConfiguration, trustedProxyConfiguration, reportTimezone, uiConfiguration);
return Objects.hash(auditLogConfiguration, cookieEncryptionKey, corsConfiguration, data, eventLogConfiguration, insertInstant, lastUpdateInstant, loginRecordConfiguration, reportTimezone, trustedProxyConfiguration, uiConfiguration, webhookEventLogConfiguration);
}

public void normalize() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, FusionAuth, All Rights Reserved
* Copyright (c) 2022-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.
Expand All @@ -25,6 +25,8 @@
* @author Rob Davis
*/
public class TenantLambdaConfiguration implements Buildable<TenantLambdaConfiguration> {
public UUID loginValidationId;

public UUID scimEnterpriseUserRequestConverterId;

public UUID scimEnterpriseUserResponseConverterId;
Expand All @@ -42,6 +44,7 @@ public TenantLambdaConfiguration() {
}

public TenantLambdaConfiguration(TenantLambdaConfiguration other) {
this.loginValidationId = other.loginValidationId;
this.scimEnterpriseUserRequestConverterId = other.scimEnterpriseUserRequestConverterId;
this.scimEnterpriseUserResponseConverterId = other.scimEnterpriseUserResponseConverterId;
this.scimGroupRequestConverterId = other.scimGroupRequestConverterId;
Expand All @@ -59,7 +62,8 @@ public boolean equals(Object o) {
return false;
}
TenantLambdaConfiguration that = (TenantLambdaConfiguration) o;
return Objects.equals(scimEnterpriseUserRequestConverterId, that.scimEnterpriseUserRequestConverterId) &&
return Objects.equals(loginValidationId, that.loginValidationId) &&
Objects.equals(scimEnterpriseUserRequestConverterId, that.scimEnterpriseUserRequestConverterId) &&
Objects.equals(scimEnterpriseUserResponseConverterId, that.scimEnterpriseUserResponseConverterId) &&
Objects.equals(scimGroupRequestConverterId, that.scimGroupRequestConverterId) &&
Objects.equals(scimGroupResponseConverterId, that.scimGroupResponseConverterId) &&
Expand All @@ -69,7 +73,8 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(scimEnterpriseUserRequestConverterId,
return Objects.hash(loginValidationId,
scimEnterpriseUserRequestConverterId,
scimEnterpriseUserResponseConverterId,
scimGroupRequestConverterId,
scimGroupResponseConverterId,
Expand All @@ -81,4 +86,4 @@ public int hashCode() {
public String toString() {
return ToString.toString(this);
}
}
}
16 changes: 2 additions & 14 deletions src/main/java/io/fusionauth/domain/event/AuditLogCreateEvent.java
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -18,13 +18,12 @@
import java.util.Objects;

import com.inversoft.json.JacksonConstructor;
import com.inversoft.json.ToString;
import io.fusionauth.domain.AuditLog;
import io.fusionauth.domain.Buildable;
import io.fusionauth.domain.EventInfo;

/**
* Event event to an audit log was created.
* Event to indicate an audit log was created.
*
* @author Daniel DeGroff
*/
Expand All @@ -42,12 +41,6 @@ public AuditLogCreateEvent(EventInfo info, AuditLog auditLog) {

@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;
}
Expand All @@ -64,9 +57,4 @@ public EventType getType() {
public int hashCode() {
return Objects.hash(super.hashCode(), auditLog);
}

@Override
public String toString() {
return ToString.toString(this);
}
}
16 changes: 14 additions & 2 deletions src/main/java/io/fusionauth/domain/event/BaseEvent.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
/*
* Copyright (c) 2018-2023, FusionAuth, All Rights Reserved
* Copyright (c) 2018-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.event;

Expand All @@ -11,7 +23,7 @@
import io.fusionauth.domain.EventInfo;

/**
* Base-class for all FusionAuth events.
* Base class for all FusionAuth events.
*
* @author Brian Pontarelli
*/
Expand Down
Loading

0 comments on commit 70ee6bf

Please sign in to comment.