fix(ClientDetailsServiceImpl.java): OAuth2客户端在管理端设置access_token有效期无效问题

This commit is contained in:
有来技术 2021-08-15 01:17:38 +08:00
parent f5429c463a
commit 3db1d6fd42

View File

@ -1,4 +1,5 @@
package com.youlai.auth.security.service; package com.youlai.auth.security.service;
import com.youlai.admin.api.OAuthClientFeignClient; import com.youlai.admin.api.OAuthClientFeignClient;
import com.youlai.admin.pojo.entity.SysOauthClient; import com.youlai.admin.pojo.entity.SysOauthClient;
import com.youlai.auth.common.enums.PasswordEncoderTypeEnum; import com.youlai.auth.common.enums.PasswordEncoderTypeEnum;
@ -32,8 +33,11 @@ public class ClientDetailsServiceImpl implements ClientDetailsService {
client.getScope(), client.getScope(),
client.getAuthorizedGrantTypes(), client.getAuthorizedGrantTypes(),
client.getAuthorities(), client.getAuthorities(),
client.getWebServerRedirectUri()); client.getWebServerRedirectUri()
);
clientDetails.setClientSecret(PasswordEncoderTypeEnum.NOOP.getPrefix() + client.getClientSecret()); clientDetails.setClientSecret(PasswordEncoderTypeEnum.NOOP.getPrefix() + client.getClientSecret());
clientDetails.setAccessTokenValiditySeconds(client.getAccessTokenValidity());
clientDetails.setRefreshTokenValiditySeconds(client.getRefreshTokenValidity());
return clientDetails; return clientDetails;
} else { } else {
throw new NoSuchClientException("No client with requested id: " + clientId); throw new NoSuchClientException("No client with requested id: " + clientId);