com.formkiq.server.service.UserService Maven / Gradle / Ivy
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 {@link String}
* @param email {@link String}
* @param password {@link String}
* @param status {@link UserStatus}
* @param userRole {@link UserRole}
* @return {@link User}
* @throws PreconditionFailedException PreconditionFailedException
*/
User createUser(final String clientId, String email, String password,
UserStatus status, UserRole userRole)
throws PreconditionFailedException;
/**
* Delete User.
* @param email {@link String}
*/
void deleteUser(final String email);
/**
* Find Active User.
* @param email {@link String}
* @param password {@link String}
* @return {@link UserDetails}
* @throws AuthenticationFailureException AuthenticationFailureException
*/
UserDetails findActiveUser(final String email,
final String password) throws AuthenticationFailureException;
/**
* Find Active User.
* @param clientid {@link String}
* @param email {@link String}
* @param password {@link String}
* @return {@link UserDetails}
* @throws AuthenticationFailureException AuthenticationFailureException
*/
UserDetails findActiveUser(String clientid, String email, String password)
throws AuthenticationFailureException;
/**
* Find user via email, regardless of UserStatus.
* @param email {@link String}
* @return {@link UserDTO}
* @throws AuthenticationFailureException AuthenticationFailureException
*/
UserDTO findUser(String email)
throws AuthenticationFailureException;
/**
* Number of Users.
* @param token {@link String}
* @return List<UserDetails>
*/
UserListDTO findUsers(String token);
/**
* Generates a reset Token.
* @param email {@link String}
* @return {@link String}
* @throws AuthenticationFailureException AuthenticationFailureException
*/
String generateResetToken(String email)
throws AuthenticationFailureException;
/**
* Generates Security Token.
* @param user {@link UserDetails}
* @return {@link String}
*/
String generateSecurityToken(UserDetails user);
/**
* Whether User exists.
* @param username {@link String}
* @return boolean
*/
boolean isUserExists(String username);
/**
* Saves User.
* @param client {@link String}
* @param email {@link String}
* @param password {@link String}
* @param role {@link UserRole}
* @param status {@link UserStatus}
* @return {@link 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 {@link String}
* @param resettoken {@link String}
* @param newPassword {@link String}
*/
void updatePassword(String email, String resettoken, String newPassword);
}