Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 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.
* 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.identity.verify;

/**
* Represent the various states/expectations of a user in the context of starting verification
*/
public enum ExistingUserStrategy {
mustExist,
mustNotExist
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
public class VerifyStartRequest implements Buildable<VerifyStartRequest> {
public UUID applicationId;

/**
* When MustExist (default), loginId/loginIdType must correspond to a user in the tenant. When this is MustNotExist, verification can begin
* without a user, in order to perform verification before user creation.
*/
public ExistingUserStrategy existingUserStrategy = ExistingUserStrategy.mustExist;

public String loginId;

public String loginIdType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*/
package io.fusionauth.domain.api.user;

import java.util.ArrayList;
import java.util.List;

import com.inversoft.json.JacksonConstructor;
import io.fusionauth.domain.EventInfo;
import io.fusionauth.domain.SendSetPasswordIdentityType;
Expand Down Expand Up @@ -48,6 +51,8 @@ public class RegistrationRequest extends BaseEventRequest {

public User user;

public List<String> verificationIds = new ArrayList<>();

@JacksonConstructor
public RegistrationRequest() {
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -16,11 +16,13 @@
package io.fusionauth.domain.api.user;

import java.time.ZonedDateTime;
import java.util.List;
import java.util.UUID;

import com.inversoft.json.JacksonConstructor;
import io.fusionauth.domain.User;
import io.fusionauth.domain.UserRegistration;
import io.fusionauth.domain.api.UserResponse.VerificationId;

/**
* Registration API request object.
Expand All @@ -44,6 +46,8 @@ public class RegistrationResponse {

public User user;

public List<VerificationId> verificationIds;

@JacksonConstructor
public RegistrationResponse() {
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/io/fusionauth/domain/form/Form.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, FusionAuth, All Rights Reserved
* Copyright (c) 2020-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.
Expand Down Expand Up @@ -85,9 +85,9 @@ public int hashCode() {

public void normalize() {
Normalizer.removeEmpty(data);
// Remove any null steps, steps w/out fields, and any null fields in steps
// Remove any null steps, collectData steps w/out fields, and any null fields in steps
Normalizer.removeEmpty(steps);
steps.removeIf(step -> step.fields.isEmpty());
steps.removeIf(step -> step.type == FormStepType.collectData && step.fields.isEmpty());
steps.stream().map(step -> step.fields).forEach(Normalizer::removeEmpty);
}

Expand Down
10 changes: 7 additions & 3 deletions src/main/java/io/fusionauth/domain/form/FormStep.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, FusionAuth, All Rights Reserved
* Copyright (c) 2020-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.
Expand All @@ -21,6 +21,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.Buildable;
Expand All @@ -31,11 +32,14 @@
public class FormStep implements Buildable<FormStep> {
public List<UUID> fields = new ArrayList<>();

public FormStepType type = FormStepType.collectData;

@JacksonConstructor
public FormStep() {
}

public FormStep(FormStep other) {
type = other.type;
fields.addAll(other.fields);
}

Expand All @@ -52,12 +56,12 @@ public boolean equals(Object o) {
return false;
}
FormStep formStep = (FormStep) o;
return Objects.equals(fields, formStep.fields);
return Objects.equals(fields, formStep.fields) && type == formStep.type;
}

@Override
public int hashCode() {
return Objects.hash(fields);
return Objects.hash(fields, type);
}

@Override
Expand Down
35 changes: 35 additions & 0 deletions src/main/java/io/fusionauth/domain/form/FormStepType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 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.
* 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.form;

/**
* Denotes the type of form step. This is used to configure different behavior on form steps in the registration flow.
*/
public enum FormStepType {
// NOTE: These are ordinal, always add to the end
/**
* Collects data from the user.
*/
collectData,
/**
* Verifies the user's email address before creating the user.
*/
verifyEmail,
/**
* Verifies the user's phone number before creating the user.
*/
verifyPhoneNumber
}