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.apple")
|
public class AppAppleAuthProperties {
|
|
private String clientId = "";
|
private String issuer = "https://appleid.apple.com";
|
private String jwksUrl = "https://appleid.apple.com/auth/keys";
|
|
/**
|
* 获取苹果登录 clientId。
|
*/
|
public String getClientId() {
|
return clientId;
|
}
|
|
/**
|
* 设置苹果登录 clientId。
|
*/
|
public void setClientId(String clientId) {
|
this.clientId = clientId;
|
}
|
|
/**
|
* 获取苹果签发方。
|
*/
|
public String getIssuer() {
|
return issuer;
|
}
|
|
/**
|
* 设置苹果签发方。
|
*/
|
public void setIssuer(String issuer) {
|
this.issuer = issuer;
|
}
|
|
/**
|
* 获取苹果 JWKS 地址。
|
*/
|
public String getJwksUrl() {
|
return jwksUrl;
|
}
|
|
/**
|
* 设置苹果 JWKS 地址。
|
*/
|
public void setJwksUrl(String jwksUrl) {
|
this.jwksUrl = jwksUrl;
|
}
|
|
/**
|
* 判断是否已配置服务端验签所需参数。
|
*/
|
public boolean isConfigured() {
|
return hasText(clientId) && hasText(issuer) && hasText(jwksUrl);
|
}
|
|
/**
|
* 判断字符串是否包含有效文本。
|
*/
|
private boolean hasText(String value) {
|
return value != null && !value.trim().isEmpty();
|
}
|
}
|