处理oauth2客户端无法登录的问题

This commit is contained in:
wanggeng 2022-08-26 18:51:08 +08:00
parent 277cfb2e11
commit dcb038f331
5 changed files with 6 additions and 2 deletions

View File

@ -55,6 +55,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
baseProperties.getLoginFailure(),
"/oauth/**",
"/oauth2_client/**",
"/error"
};
LoginFailureHandler loginFailureHandler = new LoginFailureHandler(baseProperties.getLoginFailure());
http

View File

@ -19,6 +19,8 @@ import java.util.Map;
**/
public interface IOAuth2ClientService {
String BCRYPT_PREFIX = "{bcrypt}";
/**
* 客户端加密规则
*/

View File

@ -72,7 +72,7 @@ public class OAuth2ClientDetailsServiceImpl implements ClientDetailsService {
oAuth2ClientPO.getAuthorizedGrantTypes(),
oAuth2ClientPO.getAuthorities());
clientDetails.setAutoApproveScopes(Arrays.asList(oAuth2ClientPO.getAutoapprove().split(",")));
clientDetails.setClientSecret(oAuth2ClientPO.getClientSecret());
clientDetails.setClientSecret(oAuth2ClientPO.getClientSecret().replace(IOAuth2ClientService.BCRYPT_PREFIX, ""));
clientDetails.setAccessTokenValiditySeconds(oAuth2ClientPO.getAccessTokenValidity());
clientDetails.setRefreshTokenValiditySeconds(oAuth2ClientPO.getRefreshTokenValidity());
// 设置附加信息json格式

View File

@ -48,7 +48,7 @@ public class OAuth2ClientServiceImpl extends DefaultBaseService implements IOAut
@Override
public void save(OAuth2ClientVO oauth2ClientVO) throws SaveException {
oauth2ClientVO.setClientSecret("{bcrypt}" + passwordEncoder.encode(oauth2ClientVO.getClientSecret()));
oauth2ClientVO.setClientSecret(BCRYPT_PREFIX + passwordEncoder.encode(oauth2ClientVO.getClientSecret()));
Map<String, Object> params = HashMapUtil.beanToMap(oauth2ClientVO);
setSaveInfo(params);
oauth2ClientDao.save(params);

View File

@ -54,6 +54,7 @@
<module>module-wechat-pay</module>
<module>module-attn</module>
<module>service-core</module>
<module>docs</module>
</modules>
<packaging>pom</packaging>