package com.tofly.common.core.constant;

/**
 * @author Administrator
 * @date 2019/9/3  15:09
 */
public interface SecurityConstants {


    /**
     * 内部
     */
    String FROM_IN = "Y";

    /**
     * 标志
     */
    String FROM = "from";

    /**
     * 角色前缀
     */
    String ROLE = "ROLE_";

    /**
     * {bcrypt} 加密的特征码
     */
    String BCRYPT = "{bcrypt}";


    /**
     * 前缀
     */
    String PROJECT_PREFIX = "tofly_";


    /**
     * oauth 相关前缀
     */
    String OAUTH_PREFIX = "oauth:";

    String RSOURCE_ID="tofly";

    /**
     * oauth 客户端信息
     */
    String CLIENT_DETAILS_KEY = PROJECT_PREFIX + OAUTH_PREFIX + "client:details";

    /**
     * sys_oauth_client_details 表的字段，不包括client_id、client_secret
     */
    String CLIENT_FIELDS = "client_id, CONCAT('{noop}',client_secret) as client_secret, resource_ids, scope, "
            + "authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, "
            + "refresh_token_validity, additional_information, autoapprove";



    /**
     * JdbcClientDetailsService 查询语句
     */
    String BASE_FIND_STATEMENT = "select " + CLIENT_FIELDS
            + " from TF_SMPN_OAUTHCLIENTDETAILS_X";

    /**
     * 按条件client_id 查询
     */
    String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where client_id = ?";


    /**
     * 默认的查询语句
     */
    String DEFAULT_FIND_STATEMENT = BASE_FIND_STATEMENT + " order by client_id";


    /**
     * 用户ID字段
     */
    String DETAILS_USER_ID = "id";

    /**
     * 用户名字段
     */
    String DETAILS_USERNAME = "username";

    /**
     * 用户部门字段
     */
    String DETAILS_DEPT_ID = "departmentId";


    /**
     * 用户级别字段
     */
    String DETAILS_USER_LEVEL = "userLevel";


    /**
     * 用户部门名称
     */
    String DETAILS_DEPT_NAME = "departmentName";

    /**
     * 用户名称
     */
    String DETAILS_REAL_NAME = "realName";

    /**
     * 用户名称
     */
    String DETAILS_USER_AVATAR = "avatar";

    /**
     * 项目的license
     */
    String PROJECT_LICENSE = "tofly java";

    /**
     * 协议字段
     */
    String DETAILS_LICENSE = "license";

    String APP_CONFIGURER= "toflyResourceServerConfiguration";

    /**
     * 登陆接口
     */
    String OAUTH_TOKEN_URL="/oauth/token";

    /**
     * 登陆接口
     */
    String OAUTH_LOGIN_URL="/oauth/login";

    String REDIS_LOGIN_LOCK="loginLockNew";

    Long REDIS_LOCK_TIME=20000L;

}
