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

com.boot.auth.starter.service.AuthService Maven / Gradle / Ivy

There is a newer version: 1.0.0.4
Show newest version
package com.boot.auth.starter.service;

import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;

import java.util.Map;

public interface AuthService {
    /**
     * 生成token
     *
     * @param group      权限组
     * @param userNo     用户唯一标识
     * @param roles      用户权限,多个用英文逗号隔开
     * @param parameters 除userNo和roles外要放入用户缓存的额外信息
     * @param response   http response
     * @param request    http request
     * @return 返回生成的token
     * @throws Exception 异常
     * @see com.boot.auth.starter.common.AuthConstant parameters  放入的key值参考这里
     * 需要额外放入内容请传入 com.boot.auth.starter.common.AuthConstant.SESSION_OBJECT 扩展字段
     */
    String auth(String group, String userNo, String roles, Map parameters, ServerHttpResponse response, ServerHttpRequest request) throws Exception;

    /**
     * 检测token是否有效
     *
     * @param request HttpServletRequest
     * @return true 有效
     */
    Boolean checkToken(ServerHttpRequest request);

    /**
     * 解析 token
     *
     * @param request HttpServletRequest
     * @return token内容
     */
    Map analysisToken(ServerHttpRequest request);

    /**
     * 解析 token
     *
     * @param token token
     * @return token内容
     */
    Map analysisToken(String token);

    /**
     * 删除当前请求者的auth
     *
     * @param response http response
     * @param request  http request
     */
    Boolean deleteAuth(ServerHttpResponse response, ServerHttpRequest request);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy