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

com.formkiq.server.service.UserService Maven / Gradle / Ivy

There is a newer version: 0.6.1
Show newest version
package com.formkiq.server.service;

import org.springframework.security.core.userdetails.UserDetails;

import com.formkiq.server.domain.User;
import com.formkiq.server.domain.type.UserDTO;
import com.formkiq.server.domain.type.UserListDTO;
import com.formkiq.server.domain.type.UserRole;
import com.formkiq.server.domain.type.UserStatus;

/**
 * User Services.
 *
 */
public interface UserService {

	/**
     * Creates User.
     * @param clientId String
     * @param email String
     * @param password String
     * @param status UserStatus
     * @param userRole UserRole
     * @return User
     * @throws PreconditionFailedException PreconditionFailedException
     */
    User createUser(final String clientId, String email, String password,
            UserStatus status, UserRole userRole)
                    throws PreconditionFailedException;

    /**
	 * Find Active User.
	 * @param email String
	 * @param password String
	 * @return UserDetails
	 * @throws AuthenticationFailureException AuthenticationFailureException
	 */
    UserDetails findActiveUser(String email, String password)
            throws AuthenticationFailureException;

    /**
     * Find user via email, regardless of UserStatus.
     * @param email String
     * @return UserDTO
     * @throws AuthenticationFailureException AuthenticationFailureException
     */
    UserDTO findUser(String email)
            throws AuthenticationFailureException;

    /**
     * Number of Users.
     * @return List<UserDetails>
     */
    UserListDTO findUsers();

    /**
     * Generates a reset Token.
     * @param email String
     * @return {@link String}
     * @throws AuthenticationFailureException AuthenticationFailureException
     */
    String generateResetToken(String email)
            throws AuthenticationFailureException;

    /**
     * Generates Security Token.
     * @param user User
     * @return {@link String}
     */
    String generateSecurityToken(UserDetails user);

    /**
     * Saves User.
     * @param client String
     * @param email String
     * @param password String
     * @param role UserRole
     * @param status UserStatus
     * @return User
     */
    User saveUser(String client, String email, String password,
            UserRole role, UserStatus status);

    /**
     * Updates User's password.
     * NOTE: password can also be a reset token.
     * @param email String
     * @param password String
     * @param newPassword String
     * @return boolean
     */
    boolean updatePassword(String email, String password, String newPassword);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy