[feat]:用户微信登录模块
This commit is contained in:
+20
-3
@@ -60,8 +60,8 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysUser findByOpenId(String username) {
|
public SysUser findByOpenId(String openId) {
|
||||||
SysUser sysUser = this.selectByOpenId(username);
|
SysUser sysUser = this.selectByOpenId(openId);
|
||||||
setUserPermission(sysUser);
|
setUserPermission(sysUser);
|
||||||
return sysUser;
|
return sysUser;
|
||||||
}
|
}
|
||||||
@@ -73,6 +73,23 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
|
|||||||
return sysUser;
|
return sysUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysUser findByWxOpenid(String wxOpenid) throws Exception {
|
||||||
|
SysUser sysUser = this.selectByOpenId(wxOpenid);
|
||||||
|
if (sysUser.getId() == null) {
|
||||||
|
sysUser.setOpenId(wxOpenid);
|
||||||
|
sysUser.setUsername(wxOpenid);
|
||||||
|
sysUser.setType(UserType.APP.name());
|
||||||
|
sysUser.setPassword(wxOpenid);
|
||||||
|
sysUser.setEnabled(Boolean.TRUE);
|
||||||
|
}
|
||||||
|
String username = sysUser.getUsername();
|
||||||
|
boolean result = super.saveOrUpdateIdempotency(sysUser, lock
|
||||||
|
, LOCK_KEY_USERNAME+username, new QueryWrapper<SysUser>().eq("username", username)
|
||||||
|
, username+"已存在");
|
||||||
|
return result ? sysUser : new SysUser();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUserPermission(SysUser sysUser) {
|
public void setUserPermission(SysUser sysUser) {
|
||||||
if (sysUser != null) {
|
if (sysUser != null) {
|
||||||
@@ -262,4 +279,4 @@ public class SysUserServiceImpl extends SuperServiceImpl<SysUserMapper, SysUser>
|
|||||||
}
|
}
|
||||||
return sysUserExcels;
|
return sysUserExcels;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
package com.central.oauth2.common.token;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.springframework.security.core.GrantedAuthority;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.oauth2.core.AuthorizationGrantType;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: lsl
|
||||||
|
* @date: 2024/12/16
|
||||||
|
* <p>
|
||||||
|
* Blog: https://zlt2000.gitee.io
|
||||||
|
* Github: https://github.com/zlt2000
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public class TencentAuthenticationToken extends BaseAuthenticationToken {
|
||||||
|
public static final AuthorizationGrantType GRANT_TYPE = new AuthorizationGrantType("tencent");
|
||||||
|
private final Object principal;
|
||||||
|
|
||||||
|
public TencentAuthenticationToken(String code) {
|
||||||
|
super(GRANT_TYPE);
|
||||||
|
this.principal = code;
|
||||||
|
super.setAuthenticated(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TencentAuthenticationToken(UserDetails user, Collection<? extends GrantedAuthority> authorities) {
|
||||||
|
super(authorities);
|
||||||
|
this.principal = user;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -51,6 +51,14 @@ public interface UserService {
|
|||||||
@GetMapping(value = "/users-anon/openId", params = "openId")
|
@GetMapping(value = "/users-anon/openId", params = "openId")
|
||||||
SysUser findByOpenId(@RequestParam("openId") String openId);
|
SysUser findByOpenId(@RequestParam("openId") String openId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据OpenId查询用户信息
|
||||||
|
*
|
||||||
|
* @param openId openId
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/users-anon/wxOpenId", params = "openId")
|
||||||
|
SysUser findByWxOpenId(@RequestParam("openId") String openId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取带角色的用户信息
|
* 获取带角色的用户信息
|
||||||
|
|||||||
+6
@@ -44,6 +44,12 @@ public class UserServiceFallbackFactory implements FallbackFactory<UserService>
|
|||||||
return new SysUser();
|
return new SysUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysUser findByWxOpenId(String openId) {
|
||||||
|
log.error("通过wxOpenId查询用户异常:{}", openId, throwable);
|
||||||
|
return new SysUser();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取带角色的用户信息
|
* 获取带角色的用户信息
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zlt
|
* @author zlt
|
||||||
* 用户实体
|
* 系统用户实体
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
########################## 统一变量配置 ##########################
|
########################## 统一变量配置 ##########################
|
||||||
##### 数据库配置
|
##### 数据库配置
|
||||||
zlt.datasource.ip=192.168.28.130
|
zlt.datasource.ip=127.0.0.1
|
||||||
zlt.datasource.username=root
|
zlt.datasource.username=root
|
||||||
zlt.datasource.password=1q2w3e4r
|
zlt.datasource.password=root
|
||||||
|
|
||||||
##### redis配置
|
##### redis配置
|
||||||
spring.data.redis.host=192.168.28.130
|
spring.data.redis.host=192.168.2.20
|
||||||
spring.data.redis.port=6379
|
spring.data.redis.port=6379
|
||||||
|
spring.data.redis.password=ikingtec123456
|
||||||
|
spring.data.redis.database=7
|
||||||
spring.data.redis.timeout=5000
|
spring.data.redis.timeout=5000
|
||||||
|
|
||||||
##### elasticsearch配置
|
##### elasticsearch配置
|
||||||
@@ -37,4 +39,4 @@ zlt.ribbon.isolation.enabled=false
|
|||||||
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
|
||||||
# 开启版本路由
|
# 开启版本路由
|
||||||
#zlt.loadbalance.isolation.enabled=true
|
#zlt.loadbalance.isolation.enabled=true
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
spring.profiles.active=dev
|
spring.profiles.active=dev
|
||||||
|
|
||||||
##### nacos(注册中心和配置中心)地址
|
##### nacos(注册中心和配置中心)地址
|
||||||
spring.cloud.nacos.server-addr=192.168.28.130:8848
|
spring.cloud.nacos.server-addr=192.168.4.44:8848
|
||||||
spring.cloud.nacos.username=nacos
|
spring.cloud.nacos.username=nacos
|
||||||
spring.cloud.nacos.password=nacos
|
spring.cloud.nacos.password=nacos
|
||||||
spring.cloud.nacos.config.file-extension=yml
|
spring.cloud.nacos.config.file-extension=yml
|
||||||
@@ -15,4 +15,4 @@ management.endpoints.web.exposure.include=*
|
|||||||
management.endpoint.health.show-details=always
|
management.endpoint.health.show-details=always
|
||||||
|
|
||||||
##### 允许bean覆盖
|
##### 允许bean覆盖
|
||||||
spring.main.allow-bean-definition-overriding=true
|
spring.main.allow-bean-definition-overriding=true
|
||||||
|
|||||||
@@ -33,12 +33,12 @@ server.port=8848
|
|||||||
# spring.datasource.platform=mysql
|
# spring.datasource.platform=mysql
|
||||||
|
|
||||||
### Count of DB:
|
### Count of DB:
|
||||||
# db.num=1
|
db.num=1
|
||||||
|
|
||||||
### Connect URL of DB:
|
### Connect URL of DB:
|
||||||
# db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
|
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
|
||||||
# db.user.0=nacos
|
db.user.0=root
|
||||||
# db.password.0=nacos
|
db.password.0=root
|
||||||
|
|
||||||
### Connection pool configuration: hikariCP
|
### Connection pool configuration: hikariCP
|
||||||
db.pool.config.connectionTimeout=30000
|
db.pool.config.connectionTimeout=30000
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ import com.central.oauth.support.password.PasswordAuthenticationConverter;
|
|||||||
import com.central.oauth.support.password.PasswordAuthenticationProvider;
|
import com.central.oauth.support.password.PasswordAuthenticationProvider;
|
||||||
import com.central.oauth.support.passwordCode.PasswordCodeAuthenticationConverter;
|
import com.central.oauth.support.passwordCode.PasswordCodeAuthenticationConverter;
|
||||||
import com.central.oauth.support.passwordCode.PasswordCodeAuthenticationProvider;
|
import com.central.oauth.support.passwordCode.PasswordCodeAuthenticationProvider;
|
||||||
|
import com.central.oauth.support.tencent.TencentAuthenticationConverter;
|
||||||
|
import com.central.oauth.support.tencent.TencentAuthenticationProvider;
|
||||||
import com.central.oauth2.common.component.CustomAuthorizationServiceIntrospector;
|
import com.central.oauth2.common.component.CustomAuthorizationServiceIntrospector;
|
||||||
import com.central.oauth2.common.component.CustomBearerTokenResolver;
|
import com.central.oauth2.common.component.CustomBearerTokenResolver;
|
||||||
import com.central.oauth2.common.config.BaseSecurityConfig;
|
import com.central.oauth2.common.config.BaseSecurityConfig;
|
||||||
@@ -108,6 +110,7 @@ public class AuthorizationServerConfig {
|
|||||||
.authenticationProvider(new PasswordCodeAuthenticationProvider(authorizationService, tokenGenerator, userDetailsServiceFactory, passwordEncoder, validateCodeService))
|
.authenticationProvider(new PasswordCodeAuthenticationProvider(authorizationService, tokenGenerator, userDetailsServiceFactory, passwordEncoder, validateCodeService))
|
||||||
.authenticationProvider(new OpenIdAuthenticationProvider(authorizationService, tokenGenerator, userDetailsServiceFactory))
|
.authenticationProvider(new OpenIdAuthenticationProvider(authorizationService, tokenGenerator, userDetailsServiceFactory))
|
||||||
.authenticationProvider(new MobileAuthenticationProvider(authorizationService, tokenGenerator, userDetailsServiceFactory, passwordEncoder))
|
.authenticationProvider(new MobileAuthenticationProvider(authorizationService, tokenGenerator, userDetailsServiceFactory, passwordEncoder))
|
||||||
|
.authenticationProvider(new TencentAuthenticationProvider(authorizationService, tokenGenerator, userDetailsServiceFactory))
|
||||||
)
|
)
|
||||||
// 开启OpenID Connect 1.0协议相关端点
|
// 开启OpenID Connect 1.0协议相关端点
|
||||||
.oidc(Customizer.withDefaults())
|
.oidc(Customizer.withDefaults())
|
||||||
@@ -146,6 +149,7 @@ public class AuthorizationServerConfig {
|
|||||||
new PasswordAuthenticationConverter(),
|
new PasswordAuthenticationConverter(),
|
||||||
new PasswordCodeAuthenticationConverter(),
|
new PasswordCodeAuthenticationConverter(),
|
||||||
new OpenIdAuthenticationConverter(),
|
new OpenIdAuthenticationConverter(),
|
||||||
new MobileAuthenticationConverter()));
|
new MobileAuthenticationConverter(),
|
||||||
|
new TencentAuthenticationConverter()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,4 +31,10 @@ public interface ZltUserDetailsService extends UserDetailsService {
|
|||||||
* @param userId 用户id/openId
|
* @param userId 用户id/openId
|
||||||
*/
|
*/
|
||||||
UserDetails loadUserByUserId(String userId) throws UsernameNotFoundException;
|
UserDetails loadUserByUserId(String userId) throws UsernameNotFoundException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据微信用户id/openId查询用户
|
||||||
|
* @param wxOpenId 用户id/openId
|
||||||
|
*/
|
||||||
|
UserDetails loadUserByWxOpenId(String wxOpenId) throws UsernameNotFoundException;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.security.authentication.DisabledException;
|
import org.springframework.security.authentication.DisabledException;
|
||||||
import org.springframework.security.authentication.InternalAuthenticationServiceException;
|
import org.springframework.security.authentication.InternalAuthenticationServiceException;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@@ -49,6 +50,13 @@ public class UserDetailServiceImpl implements ZltUserDetailsService {
|
|||||||
return LoginUserUtils.getLoginAppUser(sysUser);
|
return LoginUserUtils.getLoginAppUser(sysUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserDetails loadUserByWxOpenId(String wxOpenId) throws UsernameNotFoundException {
|
||||||
|
SysUser sysUser = userService.findByWxOpenId(wxOpenId);
|
||||||
|
checkUser(sysUser);
|
||||||
|
return LoginUserUtils.getLoginAppUser(sysUser);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserDetails loadUserByMobile(String mobile) {
|
public UserDetails loadUserByMobile(String mobile) {
|
||||||
SysUser sysUser = userService.findByMobile(mobile);
|
SysUser sysUser = userService.findByMobile(mobile);
|
||||||
|
|||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
package com.central.oauth.support.tencent;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.central.oauth.exception.CustomOAuth2AuthenticationException;
|
||||||
|
import com.central.oauth.support.base.BaseAuthenticationConverter;
|
||||||
|
import com.central.oauth.utils.OAuthEndpointUtils;
|
||||||
|
import com.central.oauth2.common.token.BaseAuthenticationToken;
|
||||||
|
import com.central.oauth2.common.token.TencentAuthenticationToken;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.oauth2.core.endpoint.OAuth2ParameterNames;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.util.MultiValueMap;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: zlt
|
||||||
|
* @date: 2023/11/18
|
||||||
|
* <p>
|
||||||
|
* Blog: https://zlt2000.gitee.io
|
||||||
|
* Github: https://github.com/zlt2000
|
||||||
|
*/
|
||||||
|
public class TencentAuthenticationConverter extends BaseAuthenticationConverter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String supportGrantType() {
|
||||||
|
return TencentAuthenticationToken.GRANT_TYPE.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> paramNames() {
|
||||||
|
return List.of(OAuth2ParameterNames.CODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BaseAuthenticationToken getToken(MultiValueMap<String, String> parameters) {
|
||||||
|
String code = OAuthEndpointUtils.getParam(parameters, OAuth2ParameterNames.CODE);
|
||||||
|
return new TencentAuthenticationToken(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+124
@@ -0,0 +1,124 @@
|
|||||||
|
package com.central.oauth.support.tencent;
|
||||||
|
|
||||||
|
import com.central.oauth.exception.CustomOAuth2AuthenticationException;
|
||||||
|
import com.central.oauth.service.IValidateCodeService;
|
||||||
|
import com.central.oauth.service.impl.UserDetailServiceFactory;
|
||||||
|
import com.central.oauth.support.base.BaseAuthenticationProvider;
|
||||||
|
import com.central.oauth2.common.token.TencentAuthenticationToken;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.security.core.Authentication;
|
||||||
|
import org.springframework.security.core.AuthenticationException;
|
||||||
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
|
import org.springframework.security.oauth2.core.AuthorizationGrantType;
|
||||||
|
import org.springframework.security.oauth2.core.OAuth2Token;
|
||||||
|
import org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService;
|
||||||
|
import org.springframework.security.oauth2.server.authorization.token.OAuth2TokenGenerator;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序登录 provider
|
||||||
|
*
|
||||||
|
* @author lsl
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/12/16
|
||||||
|
* <p>
|
||||||
|
* Blog: http://zlt2000.gitee.io
|
||||||
|
* Github: https://github.com/zlt2000
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
public class TencentAuthenticationProvider extends BaseAuthenticationProvider {
|
||||||
|
private final UserDetailServiceFactory userDetailsServiceFactory;
|
||||||
|
|
||||||
|
public TencentAuthenticationProvider(OAuth2AuthorizationService authorizationService
|
||||||
|
, OAuth2TokenGenerator<? extends OAuth2Token> tokenGenerator
|
||||||
|
, UserDetailServiceFactory userDetailsServiceFactory) {
|
||||||
|
super(authorizationService, tokenGenerator);
|
||||||
|
Assert.notNull(userDetailsServiceFactory, "userDetailsServiceFactory cannot be null");
|
||||||
|
this.userDetailsServiceFactory = userDetailsServiceFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supports(Class<?> authentication) {
|
||||||
|
return TencentAuthenticationToken.class.isAssignableFrom(authentication);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Authentication getPrincipal(Authentication authentication) {
|
||||||
|
TencentAuthenticationToken authToken = (TencentAuthenticationToken) authentication;
|
||||||
|
|
||||||
|
String code = (String) authToken.getPrincipal();
|
||||||
|
Map<String,Object> wxLoginResult = getWxOpenId(code);
|
||||||
|
|
||||||
|
UserDetails userDetails;
|
||||||
|
try {
|
||||||
|
userDetails = userDetailsServiceFactory.getService(authToken).loadUserByWxOpenId(wxLoginResult.get("openid").toString());
|
||||||
|
|
||||||
|
} catch (AuthenticationException e) {
|
||||||
|
throw new CustomOAuth2AuthenticationException(e.getMessage());
|
||||||
|
}
|
||||||
|
if (userDetails == null) {
|
||||||
|
|
||||||
|
throw new CustomOAuth2AuthenticationException("用户登录信息待处理,请重新登录");
|
||||||
|
}
|
||||||
|
return new TencentAuthenticationToken(userDetails, userDetails.getAuthorities());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected AuthorizationGrantType grantType() {
|
||||||
|
return TencentAuthenticationToken.GRANT_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信小程序第三方登录,或微信APP安全登录
|
||||||
|
*
|
||||||
|
* @param code 小程序code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map<String, Object> getWxOpenId(String code) {
|
||||||
|
|
||||||
|
if (code == null || code.isEmpty()) {
|
||||||
|
throw new CustomOAuth2AuthenticationException("Code cannot be null or empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
HttpHeaders headers = new HttpHeaders();
|
||||||
|
headers.set("Content-Type", "application/json");
|
||||||
|
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
params.put("appid", "appId");
|
||||||
|
params.put("secret", "appSecret");
|
||||||
|
params.put("js_code", code);
|
||||||
|
params.put("grant_type", "authorization_code");
|
||||||
|
|
||||||
|
HttpEntity<Map<String, String>> entity = new HttpEntity<>(params, headers);
|
||||||
|
ResponseEntity<Map> response = restTemplate.exchange(
|
||||||
|
"WX_LOGIN_URL",
|
||||||
|
HttpMethod.POST,
|
||||||
|
entity,
|
||||||
|
Map.class
|
||||||
|
);
|
||||||
|
|
||||||
|
if (response.getStatusCode().is2xxSuccessful()) {
|
||||||
|
Map<String, Object> body = response.getBody();
|
||||||
|
if (body != null && body.containsKey("openid")) {
|
||||||
|
return body;
|
||||||
|
} else {
|
||||||
|
throw new CustomOAuth2AuthenticationException("Failed to obtain OpenID token");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new CustomOAuth2AuthenticationException("Request failed: " + response.getStatusCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -44,4 +44,8 @@ zlt:
|
|||||||
enabled: false
|
enabled: false
|
||||||
includeSqls:
|
includeSqls:
|
||||||
# 应用列表
|
# 应用列表
|
||||||
- com.central.oauth.mapper.ClientMapper.findList
|
- com.central.oauth.mapper.ClientMapper.findList
|
||||||
|
uaa:
|
||||||
|
wx:
|
||||||
|
appId:
|
||||||
|
appsecret:
|
||||||
|
|||||||
Reference in New Issue
Block a user