package me.chyxion.tigon.shiro;

import java.io.Serializable;
import org.apache.shiro.web.servlet.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @version 0.0.1
 * @since 0.0.1
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * Apr 7, 2015 3:34:48 PM
 */
public interface SessionIdManager {
    
    /**
     * read session id from request
     * @param request http request
     * @param response http response
     * @param cookieTpl cookie template
     * @return session id
     */
    Serializable read(HttpServletRequest request, 
        HttpServletResponse response, 
        Cookie cookieTpl);
    
    /**
     * write session id to http response
     * @param request http request
     * @param response http response
     * @param cookie cookie
     * @return true if do write
     */
    boolean write(HttpServletRequest request, 
        HttpServletResponse response, 
        Cookie cookie);
}
