package com.njcn.common.pojo.constant;

/**
 * 认证业务用到的常量定义
 *
 * @author hongawen
 */
public interface SecurityConstants {

    /**
     * 认证请求头key
     * 1. 获取token时，Authorization的内容是client:secret的base64的密文
     * 2. 已经认证后，Authorization的内容是access_token内容
     */
    String AUTHORIZATION_KEY = "Authorization";

    /**
     * JWT令牌前缀
     */
    String AUTHORIZATION_PREFIX = "bearer ";

    /**
     * Basic认证前缀
     */
    String BASIC_PREFIX = "Basic ";

    /**
     * JWT载体key
     */
    String JWT_PAYLOAD_KEY = "payload";

    /**
     * JWT ID 唯一标识
     */
    String JWT_JTI = "jti";

    /**
     * JWT ID 超时key
     */
    String JWT_EXP = "exp";

    /**
     * 认证成功后，返回信息包含的内容-
     */
    String USER_INDEX_KEY = "userIndex";
    String USER_TYPE = "userType";
    String USER_NAME_KEY = "user_name";
    String USER_HEAD_KEY = "headSculpture";
    String USER_NICKNAME_KEY = "nickname";
    String CLIENT_ID_KEY = "client_id";
    String DEPT_INDEX_KEY = "deptIndex";

    /**
     * 认证方式
     */
    String AUTHENTICATION_METHOD = "authenticationMethod";

    /**
     * JWT存储权限前缀
     */
    String AUTHORITY_PREFIX = "ROLE_";

    /**
     * JWT存储权限属性
     */
    String JWT_AUTHORITIES_KEY = "authorities";

    String GRANT_TYPE_KEY = "grant_type";

    String REFRESH_TOKEN_KEY = "refresh_token";

    /**
     * 黑名单token前缀
     */
    String TOKEN_BLACKLIST_PREFIX = "auth:token:black:";

    /**
     * 认证后token前缀
     */
    String TOKEN_ONLINE_PREFIX = "auth:token:online:";


    /**
     * 真实客户端IP地址
     */
    String REQUEST_HEADER_KEY_CLIENT_REAL_IP = "realClientIp";


    /**
     * 认证需要的各项参数名
     */
    String GRANT_TYPE = "grant_type";
    String CLIENT_ID = "client_id";
    String CLIENT_SECRET = "client_secret";
    String REFRESH_TOKEN = "refresh_token";
    String USERNAME = "username";
    String PASSWORD = "password";
    String PHONE = "phone";
    String SMS_CODE = "smsCode";
    String IMAGE_CODE = "imageCode";
    String VERIFY_CODE = "verifyCode";


    /**
     * 认证阶段保存的用户登录名
     */
    String AUTHENTICATE_USERNAME = "authenticateUserName";

    /**
     * 上游服务器模块名称
     */
    String SERVER_NAME = "serverName";


    /**
     * 接口文档 Knife4j 测试客户端ID
     */
    String TEST_CLIENT_ID = "client";


    /**
     * 授权码模式
     */
    String GRANT_AUTHORIZATION_CODE = "authorization_code";

    /**
     * 验证码授权模式
     */
    String GRANT_CAPTCHA = "captcha";

    /**
     * 密码模式
     */
    String GRANT_PASSWORD = "password";

    /**
     * 刷新token模式
     */
    String GRANT_REFRESH_TOKEN = "refresh_token";

    /**
     * 短信模式
     */
    String GRANT_SMS_CODE = "sms_code";

    /**
     * 微信模式
     */
    String GRANT_WECHAT = "wechat";


}
