luoyb
2021-03-25 b622ca077cd6a4e35c1476d497999538b3720e1a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package cc.mrbird.febs.common.core.entity.constant;
 
import org.apache.commons.lang3.RandomStringUtils;
 
/**
 * @author MrBird
 */
public interface SocialConstant {
 
    String SOCIAL_LOGIN = "social_login";
    ThreadLocal<String> PASSWORD_THREAD_LOCAL = new ThreadLocal<>();
 
    /**
     * 获取随机生成的密码
     *
     * @return String 密码
     */
    static String getSocialLoginPassword() {
        String password = PASSWORD_THREAD_LOCAL.get();
        PASSWORD_THREAD_LOCAL.remove();
        return password;
    }
 
    /**
     * 设置随机生成的密码
     *
     * @return String 密码
     */
    static String setSocialLoginPassword() {
        String randomPassword = RandomStringUtils.randomAlphanumeric(64);
        PASSWORD_THREAD_LOCAL.set(randomPassword);
        return randomPassword;
    }
}