Skip to content

Instantly share code, notes, and snippets.

@mouselabsio
Created February 8, 2023 08:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mouselabsio/b7ee808d20a723f1d90a578e788fd3df to your computer and use it in GitHub Desktop.
Save mouselabsio/b7ee808d20a723f1d90a578e788fd3df to your computer and use it in GitHub Desktop.
package com.hydrafacial.nani.repository;
import com.hydrafacial.nani.models.User;
import com.hydrafacial.nani.services.UserService.LookupUserDTO;
import lombok.Data;
import lombok.experimental.Accessors;
public interface UserRepositoryRestDAO {
@Accessors(fluent = true)
@Data
class CreateUserResponse {
private String appUserKey;
private String regUserKey;
private CreateUserStatus status;
private User user;
public enum CreateUserStatus {
NEED_VERIFY, // user needs to request a 2fa verification code
USER_EXISTS, // this user already exists, client-side can log in as this user if they wish
}
}
@Accessors(fluent = true)
@Data
class LookupUserResponse {
private User user;
}
@Accessors(fluent = true)
@Data
class Request2faResponse {
private Request2faStatus request2faStatus;
private User user;
public enum Request2faStatus {
CODE_SENT, // the 2fa code was sent, client-side needs to ask the user to input the code
CODE_UNSENT, // unable to send the 2fa code, client-side needs to ask the user to retry
}
}
@Accessors(fluent = true)
@Data
class Verify2faResponse {
private User user;
private Verify2faStatus verify2faStatus;
public enum Verify2faStatus {
MATCH, // the 2fa code was successfully matched
NOT_MATCH, // the 2fa code couldn't be matched
USER_CREATED, // user was successfully created
}
}
CreateUserResponse create(CreateUserDTO dto);
User find(LookupUserDTO dto);
Request2faResponse request2fa(Request2faDTO dto);
Request2faResponse request2fa(Request2faWithReAuthDTO dto);
Verify2faResponse verify2fa(Verify2faDTO dto);
Verify2faResponse verify2fa(Verify2faWithReAuthDTO dto);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment