io.lsn.spring.auth.service.UserProvider Maven / Gradle / Ivy
package io.lsn.spring.auth.service;
import io.lsn.spring.auth.entity.User;
/**
* @author Patryk Szlagowski
*/
public interface UserProvider {
/**
* get user by generated api token
*
* @param token
* @return
* @throws Exception
*/
User findByApiToken(String token) throws Exception;
/**
* get user by username
*
* @param username username (login)
* @return
*/
User findByUsername(String username) throws Exception;
/**
* invalidate token
*
* @param user
*/
void terminateApiToken(User user) throws Exception;
/**
* authenticate user
*
* @param user user entity
* @param password password for the user
* @throws Exception
*/
void authenticate(User user, String password) throws Exception;
/**
* create new api token for user
*
* @param user
*/
void assignNewApiToken(User user) throws Exception;
/**
* extend the existing api token
*
* @param user
* @throws Exception
*/
void extendExistingApiToken(User user) throws Exception;
}