All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.memority.toolkit.inwebo.api.InWeboUser Maven / Gradle / Ivy

/*
 * Copyright (c) 2016-2023 Memority. All Rights Reserved.
 *
 * This file is part of Memority Toolkit API , a Memority project.
 *
 * This file is released under the Memority Public Artifacts End-User License Agreement,
 * see 
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 */
package com.memority.toolkit.inwebo.api;

import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * An InWebo user.
 * A user created on an InWebo service can use InWebo MFA capabilities.
 * A user can enroll a set of trusted devices.
 */
@Data
@NoArgsConstructor
@Builder
public class InWeboUser {
    private long id;
    private String login;
    private String firstName;
    private String lastName;
    private String email;
    private String phone;
    private UserStatus status;
    private long role;
    private String extrafields;
    private String activationCode;
    private Instant lastAuthenticationDate;
    private boolean pinBlocked;
    private boolean passwordBlocked;
    private boolean mAccessPasswordBlocked;
    private List trustedDevices = new ArrayList<>();


    public InWeboUser(long id,
                      String login,
                      String firstName,
                      String lastName,
                      String email,
                      String phone,
                      UserStatus status,
                      long role,
                      String extrafields,
                      String activationCode,
                      Instant lastAuthenticationDate,
                      boolean pinBlocked,
                      boolean passwordBlocked,
                      boolean mAccessPasswordBlocked,
                      List trustedDevices) {
        this.id = id;
        this.login = login;
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
        this.phone = phone;
        this.status = status;
        this.role = role;
        this.extrafields = extrafields;
        this.activationCode = activationCode;
        this.lastAuthenticationDate = lastAuthenticationDate;
        this.pinBlocked = pinBlocked;
        this.passwordBlocked = passwordBlocked;
        this.mAccessPasswordBlocked = mAccessPasswordBlocked;
        if (trustedDevices != null) {
            this.trustedDevices.addAll(trustedDevices);
        }
    }

    public List getTrustedDevices() {
        return new ArrayList<>(trustedDevices);
    }

    public void addDevice(TrustedDevice... devices) {
        this.trustedDevices.addAll(Arrays.asList(devices));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy