接上一篇:快速开发工作流_02_集成在线流程设计器
https://gblfy.blog.csdn.net/article/details/103676784
文章目录
- 八、内置用户免登录
- 8.1. 定位url-config.js
- 8.2. 替换url
- 8.3. 添加配置类AdminRemoteAccountResource
- 8.4. 启动类排除权限校验
- 8.5. 码云地址
八、内置用户免登录
8.1. 定位url-config.js
springboot-flowable-modeler\flowable\src\main\resources\static\scripts\configuration\url-config.js
8.2. 替换url
将
return FLOWABLE.CONFIG.contextRoot + '/app/rest/account';
替换为
return FLOWABLE.CONFIG.contextRoot + '/admin/rest/account';
8.3. 添加配置类AdminRemoteAccountResource
package com.gblfy.flowable.controller;import org.flowable.idm.api.User;
import org.flowable.idm.engine.impl.persistence.entity.UserEntityImpl;
import org.flowable.ui.common.model.UserRepresentation;
import org.flowable.ui.common.security.SecurityUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;import java.util.ArrayList;
import java.util.List;/*** @author gblfy* @ClassNme AdminRemoteAccountResource* @Description 实现内置admin用户免登陆* @Date 2019/11/10 15:13* @version1.0*/
@RestController
@RequestMapping("/admin")
public class AdminRemoteAccountResource {/*** GET /rest/account -> get the current user.*/@RequestMapping(value = "/rest/account", method = RequestMethod.GET, produces = "application/json")public UserRepresentation getAccount() {User user=new UserEntityImpl();user.setId("admin");SecurityUtils.assumeUser(user);UserRepresentation userRepresentation = new UserRepresentation();userRepresentation.setId("admin");userRepresentation.setFirstName("admin");List<String> privileges=new ArrayList<>();privileges.add("flowable-idm");privileges.add("flowable-modeler");privileges.add("flowable-task");userRepresentation.setPrivileges(privileges);return userRepresentation;}
}
8.4. 启动类排除权限校验
package com.gblfy.flowable;import com.gblfy.flowable.config.ApplicationConfiguration;
import com.gblfy.flowable.servlet.AppDispatcherServletConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.transaction.annotation.EnableTransactionManagement;@Import({ApplicationConfiguration.class,AppDispatcherServletConfiguration.class
})
@ComponentScan(basePackages = {"com.gblfy.flowable"})
@EnableTransactionManagement
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
//@SpringBootApplication
public class FlowableApplication {public static void main(String[] args) {SpringApplication.run(FlowableApplication.class, args);}}
8.5. 码云地址
https://gitee.com/gb_90/springboot-flowable-modeler