完善积木报表的集成
parent
40520b6c88
commit
d872676748
@ -1,44 +0,0 @@
|
|||||||
package cn.iocoder.yudao.module.visualization.config;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi;
|
|
||||||
import cn.iocoder.yudao.module.system.api.oauth2.dto.OAuth2AccessTokenCheckRespDTO;
|
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
|
||||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
|
||||||
import org.jeecg.modules.jmreport.api.JmReportTokenServiceI;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class JimuReportTokenService implements JmReportTokenServiceI {
|
|
||||||
@Autowired
|
|
||||||
private OAuth2TokenApi oauth2TokenApi;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AdminUserService adminUserService;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUsername(String token) {
|
|
||||||
if (StrUtil.isNotEmpty(token)) {
|
|
||||||
OAuth2AccessTokenCheckRespDTO accessToken = oauth2TokenApi.checkAccessToken(token);
|
|
||||||
if (accessToken != null) {
|
|
||||||
Long userId = accessToken.getUserId();
|
|
||||||
System.out.println(userId);
|
|
||||||
AdminUserDO user = adminUserService.getUser(userId);
|
|
||||||
if (user != null) {
|
|
||||||
return user.getUsername();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean verifyToken(String token) {
|
|
||||||
if (StrUtil.isNotEmpty(token)) {
|
|
||||||
OAuth2AccessTokenCheckRespDTO accessToken = oauth2TokenApi.checkAccessToken(token);
|
|
||||||
return accessToken != null;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package cn.iocoder.yudao.module.visualization.framework.jmreport.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi;
|
||||||
|
import cn.iocoder.yudao.module.visualization.framework.jmreport.core.service.JmReportTokenServiceImpl;
|
||||||
|
import org.jeecg.modules.jmreport.api.JmReportTokenServiceI;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积木报表的配置类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class JmReportConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
|
||||||
|
public JmReportTokenServiceI jmReportTokenService(OAuth2TokenApi oAuth2TokenApi) {
|
||||||
|
return new JmReportTokenServiceImpl(oAuth2TokenApi);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
/**
|
||||||
|
* 属于 visualization 模块的 framework 封装
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
package cn.iocoder.yudao.module.visualization.framework;
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package cn.iocoder.yudao.module.visualization.framework.security.config;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visualization 模块的 Security 配置
|
||||||
|
*/
|
||||||
|
@Configuration("visualizationSecurityConfiguration")
|
||||||
|
public class SecurityConfiguration {
|
||||||
|
|
||||||
|
@Bean("visualizationAuthorizeRequestsCustomizer")
|
||||||
|
public AuthorizeRequestsCustomizer authorizeRequestsCustomizer() {
|
||||||
|
return new AuthorizeRequestsCustomizer() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
|
||||||
|
//积木报表
|
||||||
|
registry.antMatchers("/jmreport/**").permitAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* 占位
|
||||||
|
*/
|
||||||
|
package cn.iocoder.yudao.module.visualization.framework.security.core;
|
||||||
Loading…
Reference in New Issue