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();
|
}
|
}
|