package me.chyxion.tigon.shiro.service;

import org.apache.shiro.session.Session;
import me.chyxion.tigon.shiro.model.AuthUser;

/**
 * @version 0.0.1
 * @since 0.0.1
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * May 12, 2016 2:21:40 PM
 */
public interface AuthService {
    
    /**
     * login with loginId and password
     * @param loginId login id
     * @param password password
     * @return auth user
     */
    <U> AuthUser<U> login(String loginId, String password); 

    /**
     * @param loginId login id
     * @param password password
     * @param rememberMe remember me
     * @return auth user
     */
    <U> AuthUser<U> login(String loginId, String password, boolean rememberMe); 
    
    /**
     * logout current user
     */
    void logout(); 
    
    /**
     * get auth user from session
     * @param <U> auth user data type
     * @return auth user or null
     */
    <U> AuthUser<U> getAuthUser(); 
    
    /**
     * check if authenticated
     * @return true if authenticated
     */
    boolean isAuthenticated(); 
    
    /**
     * get current session
     * @return session
     */
    Session getSession(); 
}
