hejianhao
2026-08-28 16a57a8fc6868cea9171a1119698572407a2fc03
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.tcm.training.admin.app.auth.config;
 
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
 
/**
 * APP 微信登录配置。
 */
@Component
@ConfigurationProperties(prefix = "app.auth.wechat")
public class AppWechatAuthProperties {
 
    private String appId = "";
    private String appSecret = "";
    private String userInfoUrl = "https://api.weixin.qq.com/sns/userinfo";
    private String accessTokenUrl = "https://api.weixin.qq.com/sns/oauth2/access_token";
 
    /**
     * 获取微信开放平台 AppId。
     */
    public String getAppId() {
        return appId;
    }
 
    /**
     * 设置微信开放平台 AppId。
     */
    public void setAppId(String appId) {
        this.appId = appId;
    }
 
    /**
     * 获取微信开放平台 AppSecret。
     */
    public String getAppSecret() {
        return appSecret;
    }
 
    /**
     * 设置微信开放平台 AppSecret。
     */
    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }
 
    /**
     * 获取微信用户信息接口地址。
     */
    public String getUserInfoUrl() {
        return userInfoUrl;
    }
 
    /**
     * 设置微信用户信息接口地址。
     */
    public void setUserInfoUrl(String userInfoUrl) {
        this.userInfoUrl = userInfoUrl;
    }
 
    /**
     * 获取微信授权换票接口地址。
     */
    public String getAccessTokenUrl() {
        return accessTokenUrl;
    }
 
    /**
     * 设置微信授权换票接口地址。
     */
    public void setAccessTokenUrl(String accessTokenUrl) {
        this.accessTokenUrl = accessTokenUrl;
    }
 
    /**
     * 判断是否已配置服务端换票所需参数。
     */
    public boolean isServerAuthConfigured() {
        return hasText(appId) && hasText(appSecret);
    }
 
    /**
     * 判断字符串是否包含有效文本。
     */
    private boolean hasText(String value) {
        return value != null && !value.trim().isEmpty();
    }
}